1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00

Fix null email parameter from missing email claim (#993)

This commit is contained in:
Chad Scharf 2020-11-13 11:26:05 -05:00 committed by GitHub
parent fefa0e2dea
commit 80f2bf9260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,7 @@ namespace Bit.Core.IdentityServer
{ {
var email = context.Result.ValidatedRequest.Subject?.GetDisplayName() 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); var user = string.IsNullOrWhiteSpace(email) ? null : await _userManager.FindByEmailAsync(email);
return (user, user != null); return (user, user != null);
} }