diff --git a/src/Api/IdentityServer/ProfileService.cs b/src/Api/IdentityServer/ProfileService.cs index c22cee368c..f268a69f58 100644 --- a/src/Api/IdentityServer/ProfileService.cs +++ b/src/Api/IdentityServer/ProfileService.cs @@ -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 @@ -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 GetUserAsync(ClaimsPrincipal principal) - { - var userId = _userService.GetProperUserId(principal); - if(userId.HasValue) - { - return await _userService.GetUserByIdAsync(userId.Value); - } - - return null; - } } }