ClaimsPrincipal.FindAll Method

Definition

Retrieves all of the claims that match a specified condition.

Overloads

FindAll(Predicate<Claim>)

Retrieves all of the claims that are matched by the specified predicate.

FindAll(String)

Retrieves all or the claims that have the specified claim type.

FindAll(Predicate<Claim>)

Source:
ClaimsPrincipal.cs
Source:
ClaimsPrincipal.cs
Source:
ClaimsPrincipal.cs

Retrieves all of the claims that are matched by the specified predicate.

C#
public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> FindAll(Predicate<System.Security.Claims.Claim> match);

Parameters

match
Predicate<Claim>

The function that performs the matching logic.

Returns

The matching claims.

Exceptions

match is null.

Remarks

Returns claims from all identities associated with the claims principal.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

FindAll(String)

Source:
ClaimsPrincipal.cs
Source:
ClaimsPrincipal.cs
Source:
ClaimsPrincipal.cs

Retrieves all or the claims that have the specified claim type.

C#
public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> FindAll(string type);

Parameters

type
String

The claim type against which to match claims.

Returns

The matching claims.

Exceptions

type is null.

Remarks

Returns claims from all identities associated with the claims principal. The comparison is made using Ordinal case in-sensitive on type.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0