mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 21:18:13 -05:00
use GetUserByPrincipalAsync
This commit is contained in:
parent
ac18893d67
commit
4a5366005a
@ -32,7 +32,7 @@ namespace Bit.Api.IdentityServer
|
||||
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
|
||||
{
|
||||
var claims = context.Subject.Claims.ToList();
|
||||
var user = await GetUserAsync(context.Subject);
|
||||
var user = await _userService.GetUserByPrincipalAsync(context.Subject);
|
||||
if(user != null)
|
||||
{
|
||||
claims.AddRange(new List<Claim>
|
||||
@ -62,7 +62,7 @@ namespace Bit.Api.IdentityServer
|
||||
{
|
||||
var securityTokenClaim = context.Subject?.Claims.FirstOrDefault(c =>
|
||||
c.Type == _identityOptions.ClaimsIdentity.SecurityStampClaimType);
|
||||
var user = await GetUserAsync(context.Subject);
|
||||
var user = await _userService.GetUserByPrincipalAsync(context.Subject);
|
||||
|
||||
if(user != null && securityTokenClaim != null)
|
||||
{
|
||||
@ -75,16 +75,5 @@ namespace Bit.Api.IdentityServer
|
||||
context.IsActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<User> GetUserAsync(ClaimsPrincipal principal)
|
||||
{
|
||||
var userId = _userService.GetProperUserId(principal);
|
||||
if(userId.HasValue)
|
||||
{
|
||||
return await _userService.GetUserByIdAsync(userId.Value);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user