1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Performed some null checks (#991)

This commit is contained in:
Addison Beck
2020-11-13 08:53:36 -05:00
committed by GitHub
parent ac1defc97a
commit e35faf1335

View File

@ -54,7 +54,7 @@ namespace Bit.Core.IdentityServer
protected async override Task<(User, bool)> ValidateContextAsync(CustomTokenRequestValidationContext context)
{
var email = context.Result.ValidatedRequest.Subject?.GetDisplayName()
?? context.Result.ValidatedRequest.ClientClaims.FirstOrDefault(claim => claim.Type == JwtClaimTypes.Email).Value;
?? context.Result.ValidatedRequest.ClientClaims?.FirstOrDefault(claim => claim.Type == JwtClaimTypes.Email)?.Value;
var user = await _userManager.FindByEmailAsync(email);
return (user, user != null);
}