Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
gmf520 committed Jan 12, 2024
1 parent 02f688a commit 5e32460
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/OSharp.Identity/Identity/IdentityPackBase.cs
Expand Up @@ -74,7 +74,7 @@ public override IServiceCollection AddServices(IServiceCollection services)
{
IHttpContextAccessor accessor = provider.GetService<IHttpContextAccessor>();
ClaimsPrincipal principal = accessor?.HttpContext?.User;
if (principal != null && principal.Identity is ClaimsIdentity identity)
if (principal is { Identity: ClaimsIdentity identity })
{
PropertyInfo property = typeof(TUser).GetProperty("Id");
if (property != null && !identity.HasClaim(m => m.Type == OsharpConstants.UserIdTypeName))
Expand Down Expand Up @@ -127,4 +127,4 @@ protected virtual IdentityBuilder OnIdentityBuild(IdentityBuilder builder)
{
return builder.AddDefaultTokenProviders();
}
}
}

0 comments on commit 5e32460

Please sign in to comment.