1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 16:42:50 -05:00

Moved identity implementations to scoped lifetime since they have dependencies on CurrentContext

This commit is contained in:
Kyle Spearrin
2017-01-25 22:31:14 -05:00
parent 5b7af84208
commit f2d58a3678
3 changed files with 23 additions and 32 deletions

View File

@ -104,8 +104,8 @@ namespace Bit.Api
identityServerBuilder.AddTemporarySigningCredential();
}
services.AddSingleton<IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>();
services.AddSingleton<IProfileService, ProfileService>();
services.AddScoped<IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>();
services.AddScoped<IProfileService, ProfileService>();
services.AddSingleton<IPersistedGrantStore, PersistedGrantStore>();
// Identity
@ -257,12 +257,7 @@ namespace Bit.Api
NameClaimType = ClaimTypes.Email,
// Version "2" until we retire the old jwt scheme and replace it with this one.
AuthenticationScheme = "Bearer2",
TokenRetriever = TokenRetrieval.FromAuthorizationHeaderOrQueryString("Bearer2", "access_token2"),
JwtBearerEvents = new JwtBearerEvents
{
OnTokenValidated = JwtBearerEventImplementations.ValidatedTokenAsync,
OnAuthenticationFailed = JwtBearerEventImplementations.AuthenticationFailedAsync
}
TokenRetriever = TokenRetrieval.FromAuthorizationHeaderOrQueryString("Bearer2", "access_token2")
});
// Add Jwt authentication to the request pipeline.