ClaimsPrincipal.HasClaim ClaimsPrincipal.HasClaim ClaimsPrincipal.HasClaim ClaimsPrincipal.HasClaim Method

Definition

Determines whether any of the claims identities associated with this claims principal contains a claim that matches specified conditions.

Overloads

HasClaim(Predicate<Claim>) HasClaim(Predicate<Claim>) HasClaim(Predicate<Claim>) HasClaim(Predicate<Claim>)

Determines whether any of the claims identities associated with this claims principal contains a claim that is matched by the specified predicate.

HasClaim(String, String) HasClaim(String, String) HasClaim(String, String) HasClaim(String, String)

Determines whether any of the claims identities associated with this claims principal contains a claim with the specified claim type and value.

HasClaim(Predicate<Claim>) HasClaim(Predicate<Claim>) HasClaim(Predicate<Claim>) HasClaim(Predicate<Claim>)

Determines whether any of the claims identities associated with this claims principal contains a claim that is matched by the specified predicate.

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

Parameters

match
Predicate<Claim>

The function that performs the matching logic.

Returns

true if a matching claim exists; otherwise, false.

Exceptions

Remarks

Each ClaimsIdentity is called.

See also

ClaimsIdentity.HasClaim(String, String).

HasClaim(String, String) HasClaim(String, String) HasClaim(String, String) HasClaim(String, String)

Determines whether any of the claims identities associated with this claims principal contains a claim with the specified claim type and value.

public:
 virtual bool HasClaim(System::String ^ type, System::String ^ value);
public virtual bool HasClaim (string type, string value);
abstract member HasClaim : string * string -> bool
override this.HasClaim : string * string -> bool
Public Overridable Function HasClaim (type As String, value As String) As Boolean

Parameters

type
String String String String

The type of the claim to match.

value
String String String String

The value of the claim to match.

Returns

true if a matching claim exists; otherwise, false.

Exceptions

Remarks

Does not check the Issuer or OriginalIssuer properties. The comparison is made using Ordinal, case sensitive on value; case in-sensitive on type.

Applies to