Exemple #1
0
 protected HasClaimAuthorizationHandler(SecurityClaimTypes claimType, string?claimValue = null)
 {
     _claimType  = claimType;
     _claimValue = claimValue;
 }
 public static bool HasClaim(ClaimsPrincipal user, SecurityClaimTypes claimType, string?claimValue = null)
 {
     return(user.HasClaim(
                c => c.Type == claimType.ToString() && (claimValue == null || c.Value == claimValue)));
 }