FindAll() публичный Метод

Retrieves a IEnumerable{Claim} where each claim is matched by .
Each ClaimsIdentity is called. ClaimsIdentity.FindAll.
if 'match' is null.
public FindAll ( Predicate match ) : IEnumerable
match Predicate The predicate that performs the matching logic.
Результат IEnumerable
Пример #1
0
 public static IEnumerable <string> GetClaimValues(
     this ClaimsPrincipal principal,
     string claimType)
 {
     return(principal.FindAll(claimType)
            .Select(x => x.Value));
 }
        public IPrincipal Transform(ClaimsPrincipal principal)
        {
            var roles = principal
                .FindAll(ClaimTypes.Role)
                .Select(x => x.Value)
                .ToArray();

            return new SamplePrincipal(principal.Identity, roles);
        }
 private bool ScopePresent(ClaimsPrincipal principal)
 {
     foreach (var scope in principal.FindAll("scope"))
     {
         if (_requiredScopes.Contains(scope.Value))
         {
             return true;
         }
     }
     return false;
 }
        private bool ScopesFound(ClaimsPrincipal principal)
        {
            var scopeClaims = principal.FindAll(_options.ScopeClaimType);

            if (scopeClaims == null || !scopeClaims.Any())
            {
                return false;
            }

            foreach (var scope in scopeClaims)
            {
                if (_options.AllowedScopes.Contains(scope.Value, StringComparer.Ordinal))
                {
                    return true;
                }
            }

            return false;
        }
 private IEnumerable<Claim> FilterInternalClaims(ClaimsPrincipal principal)
 {
     return principal.FindAll(c => 
         c.Type != "exp" && 
         c.Type != "nbf" && 
         c.Type != "iss" && 
         c.Type != "aud");
 }
        private static IEnumerable<UserRole> GetUserRoles(ClaimsPrincipal principal)
        {
            var roleClaims = principal.FindAll(ClaimTypes.Role);

            foreach (var claim in roleClaims)
            {
                UserRole role;
                if (Enum.TryParse(claim.Value, true, out role))
                {
                    yield return role;
                }
            }
        }
        public static List<Claim> GetOutputClaims(ClaimsPrincipal principal, RequestDetails requestDetails, IClaimsRepository claimsRepository)
        {
            var name = principal.FindAll(ClaimTypes.Name).First().Value;
            var nameId = new Claim(ClaimTypes.NameIdentifier, name);

            var userClaims = new List<Claim> 
            {
                new Claim(ClaimTypes.Name, name),
                nameId,
                new Claim(ClaimTypes.AuthenticationMethod, principal.FindAll(ClaimTypes.AuthenticationMethod).First().Value),
                AuthenticationInstantClaim.Now
            };

            userClaims.AddRange(claimsRepository.GetClaims(principal, requestDetails));

            return userClaims;
        }
 public IEnumerable<Claim> ProcessClaims(ClaimsPrincipal incomingPrincipal, IdentityProvider identityProvider, RequestDetails details)
 {
     var claims = incomingPrincipal.FindAll(c => c.Type != Constants.Claims.IdentityProvider);
     return claims;
 }