Fixing that OpenIdAuthenticationService.GetAuthenticatedUser should check the user's name

This commit is contained in:
Lombiq
2018-10-29 17:42:29 +01:00
committed by Benedek Farkas
parent 7f07d16412
commit 668d9443d8

View File

@@ -80,9 +80,9 @@ namespace Orchard.OpenId.Services {
return FallbackAuthenticationService.GetAuthenticatedUser(); return FallbackAuthenticationService.GetAuthenticatedUser();
} }
var user = _httpContextAccessor.Current().GetOwinContext().Authentication.User; var userIdentity = _httpContextAccessor.Current().GetOwinContext().Authentication.User.Identity;
if (!user.Identity.IsAuthenticated) { if (string.IsNullOrEmpty(userIdentity.Name?.Trim()) || !userIdentity.IsAuthenticated) {
return null; return null;
} }
@@ -91,7 +91,7 @@ namespace Orchard.OpenId.Services {
return _localAuthenticationUser; return _localAuthenticationUser;
} }
var userName = user.Identity.Name.Trim(); var userName = userIdentity.Name.Trim();
//Get the local user, if local user account doesn't exist, create it //Get the local user, if local user account doesn't exist, create it
var localUser = var localUser =