Bewerken

Share via


ClaimsPrincipal.FindFirst Method

Definition

Retrieves the first claim that matches a specified condition.

Overloads

FindFirst(Predicate<Claim>)

Retrieves the first claim that is matched by the specified predicate.

FindFirst(String)

Retrieves the first claim with the specified claim type.

FindFirst(Predicate<Claim>)

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

Retrieves the first claim that is matched by the specified predicate.

public:
 virtual System::Security::Claims::Claim ^ FindFirst(Predicate<System::Security::Claims::Claim ^> ^ match);
public virtual System.Security.Claims.Claim FindFirst (Predicate<System.Security.Claims.Claim> match);
public virtual System.Security.Claims.Claim? FindFirst (Predicate<System.Security.Claims.Claim> match);
abstract member FindFirst : Predicate<System.Security.Claims.Claim> -> System.Security.Claims.Claim
override this.FindFirst : Predicate<System.Security.Claims.Claim> -> System.Security.Claims.Claim
Public Overridable Function FindFirst (match As Predicate(Of Claim)) As Claim

Parameters

match
Predicate<Claim>

The function that performs the matching logic.

Returns

The first matching claim or null if no match is found.

Exceptions

match is null.

Remarks

Each ClaimsIdentity is called.

See also

ClaimsIdentity.FindFirst(String)

Applies to

FindFirst(String)

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

Retrieves the first claim with the specified claim type.

public:
 virtual System::Security::Claims::Claim ^ FindFirst(System::String ^ type);
public virtual System.Security.Claims.Claim FindFirst (string type);
public virtual System.Security.Claims.Claim? FindFirst (string type);
abstract member FindFirst : string -> System.Security.Claims.Claim
override this.FindFirst : string -> System.Security.Claims.Claim
Public Overridable Function FindFirst (type As String) As Claim

Parameters

type
String

The claim type to match.

Returns

The first matching claim or null if no match is found.

Exceptions

type is null.

Remarks

Each ClaimsIdentity is called.

See also

ClaimsIdentity.FindFirst(Predicate<Claim>).

Applies to