Class OpenIddictExtensions
- Namespace
- OpenIddict.Abstractions
- Assembly
- OpenIddict.Abstractions.dll
Provides extension methods to make OpenIddictRequest and OpenIddictResponse easier to work with.
public static class OpenIddictExtensions
- Inheritance
-
OpenIddictExtensions
- Inherited Members
Methods
AddClaim(ClaimsIdentity, string, bool)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, bool value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueboolThe value associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, bool, string)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, bool value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueboolThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, IDictionary<string, string?>)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, IDictionary<string, string?> value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueIDictionary<string, string>The value associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, IDictionary<string, string?>, string)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, IDictionary<string, string?> value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueIDictionary<string, string>The value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, long)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, long value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuelongThe value associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, long, string)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, long value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuelongThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, string)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, string value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuestringThe value associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, string, string)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, string value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuestringThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, JsonElement)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, JsonElement value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueJsonElementThe value associated with the claim.
Returns
AddClaim(ClaimsIdentity, string, JsonElement, string)
Adds a claim to a given identity.
public static ClaimsIdentity AddClaim(this ClaimsIdentity identity, string type, JsonElement value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueJsonElementThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, bool)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, bool value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueboolThe value associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, bool, string)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, bool value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueboolThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, IDictionary<string, string?>)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, IDictionary<string, string?> value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueIDictionary<string, string>The value associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, IDictionary<string, string?>, string)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, IDictionary<string, string?> value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueIDictionary<string, string>The value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, long)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, long value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuelongThe value associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, long, string)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, long value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuelongThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, string)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, string value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuestringThe value associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, string, string)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, string value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuestringThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, JsonElement)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, JsonElement value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueJsonElementThe value associated with the claim.
Returns
AddClaim(ClaimsPrincipal, string, JsonElement, string)
Adds a claim to a given principal.
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, JsonElement value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueJsonElementThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
AddClaims(ClaimsIdentity, string, ImmutableArray<string>)
Adds claims to a given identity.
public static ClaimsIdentity AddClaims(this ClaimsIdentity identity, string type, ImmutableArray<string> values)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
valuesImmutableArray<string>The values associated with the claims.
Returns
AddClaims(ClaimsIdentity, string, ImmutableArray<string>, string)
Adds claims to a given identity.
public static ClaimsIdentity AddClaims(this ClaimsIdentity identity, string type, ImmutableArray<string> values, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
valuesImmutableArray<string>The values associated with the claims.
issuerstringThe issuer associated with the claims.
Returns
AddClaims(ClaimsIdentity, string, JsonElement)
Adds claims to a given identity.
public static ClaimsIdentity AddClaims(this ClaimsIdentity identity, string type, JsonElement value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
valueJsonElementThe value associated with the claims.
Returns
AddClaims(ClaimsIdentity, string, JsonElement, string)
Adds claims to a given identity.
public static ClaimsIdentity AddClaims(this ClaimsIdentity identity, string type, JsonElement value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
valueJsonElementThe value associated with the claims.
issuerstringThe issuer associated with the claims.
Returns
AddClaims(ClaimsPrincipal, string, ImmutableArray<string>)
Adds claims to a given principal.
public static ClaimsPrincipal AddClaims(this ClaimsPrincipal principal, string type, ImmutableArray<string> values)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
valuesImmutableArray<string>The values associated with the claims.
Returns
AddClaims(ClaimsPrincipal, string, ImmutableArray<string>, string)
Adds claims to a given principal.
public static ClaimsPrincipal AddClaims(this ClaimsPrincipal principal, string type, ImmutableArray<string> values, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
valuesImmutableArray<string>The values associated with the claims.
issuerstringThe issuer associated with the claims.
Returns
AddClaims(ClaimsPrincipal, string, JsonElement)
Adds claims to a given principal.
public static ClaimsPrincipal AddClaims(this ClaimsPrincipal principal, string type, JsonElement value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
valueJsonElementThe value associated with the claims.
Returns
AddClaims(ClaimsPrincipal, string, JsonElement, string)
Adds claims to a given principal.
public static ClaimsPrincipal AddClaims(this ClaimsPrincipal principal, string type, JsonElement value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
valueJsonElementThe value associated with the claims.
issuerstringThe issuer associated with the claims.
Returns
Clone(ClaimsIdentity, Func<Claim, bool>)
Clones an identity by filtering its claims and the claims of its actor, recursively.
public static ClaimsIdentity Clone(this ClaimsIdentity identity, Func<Claim, bool> filter)
Parameters
identityClaimsIdentityThe ClaimsIdentity instance to filter.
filterFunc<Claim, bool>The delegate filtering the claims: return true to accept the claim, false to remove it.
Returns
Clone(ClaimsPrincipal, Func<Claim, bool>)
Clones a principal by filtering its identities.
public static ClaimsPrincipal Clone(this ClaimsPrincipal principal, Func<Claim, bool> filter)
Parameters
principalClaimsPrincipalThe ClaimsPrincipal instance to filter.
filterFunc<Claim, bool>The delegate filtering the claims: return true to accept the claim, false to remove it.
Returns
GetAccessTokenLifetime(ClaimsIdentity)
Gets the access token lifetime associated with the claims identity.
public static TimeSpan? GetAccessTokenLifetime(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetAccessTokenLifetime(ClaimsPrincipal)
Gets the access token lifetime associated with the claims principal.
public static TimeSpan? GetAccessTokenLifetime(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetAcrValues(OpenIddictRequest)
Extracts the authentication context class values from an OpenIddictRequest.
public static ImmutableArray<string> GetAcrValues(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
GetAudiences(ClaimsIdentity)
Gets the audiences list stored in the claims identity.
public static ImmutableArray<string> GetAudiences(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
- ImmutableArray<string>
The audiences list or an empty set if the claims cannot be found.
GetAudiences(ClaimsPrincipal)
Gets the audiences list stored in the claims principal.
public static ImmutableArray<string> GetAudiences(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
- ImmutableArray<string>
The audiences list or an empty set if the claims cannot be found.
GetAuthorizationCodeLifetime(ClaimsIdentity)
Gets the authorization code lifetime associated with the claims identity.
public static TimeSpan? GetAuthorizationCodeLifetime(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetAuthorizationCodeLifetime(ClaimsPrincipal)
Gets the authorization code lifetime associated with the claims principal.
public static TimeSpan? GetAuthorizationCodeLifetime(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetAuthorizationId(ClaimsIdentity)
Gets the internal authorization identifier associated with the claims identity.
public static string? GetAuthorizationId(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetAuthorizationId(ClaimsPrincipal)
Gets the internal authorization identifier associated with the claims principal.
public static string? GetAuthorizationId(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetClaim(ClaimsIdentity, string)
Gets the unique claim value corresponding to the given type.
public static string? GetClaim(this ClaimsIdentity identity, string type)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
Returns
- string
The claim value.
Exceptions
- InvalidOperationException
Multiple claims using the same
typeare present in the identity.
GetClaim(ClaimsPrincipal, string)
Gets the unique claim value corresponding to the given type.
public static string? GetClaim(this ClaimsPrincipal principal, string type)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
Returns
- string
The claim value.
Exceptions
- InvalidOperationException
Multiple claims using the same
typeare present in the principal.
GetClaims(ClaimsIdentity, string)
Gets all the claim values corresponding to the given type.
public static ImmutableArray<string> GetClaims(this ClaimsIdentity identity, string type)
Parameters
identityClaimsIdentityThe claims identity.
typestringThe type associated with the claims.
Returns
- ImmutableArray<string>
The claim values.
GetClaims(ClaimsPrincipal, string)
Gets all the claim values corresponding to the given type.
public static ImmutableArray<string> GetClaims(this ClaimsPrincipal principal, string type)
Parameters
principalClaimsPrincipalThe claims principal.
typestringThe type associated with the claims.
Returns
- ImmutableArray<string>
The claim values.
GetCreationDate(ClaimsIdentity)
Gets the creation date stored in the claims identity.
public static DateTimeOffset? GetCreationDate(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
- DateTimeOffset?
The creation date or null if the claim cannot be found.
GetCreationDate(ClaimsPrincipal)
Gets the creation date stored in the claims principal.
public static DateTimeOffset? GetCreationDate(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
- DateTimeOffset?
The creation date or null if the claim cannot be found.
GetDestinations(Claim)
Gets the destinations associated with a claim.
public static ImmutableArray<string> GetDestinations(this Claim claim)
Parameters
Returns
- ImmutableArray<string>
The destinations associated with the claim.
GetDestinations(ClaimsIdentity)
Gets the destinations associated with all the claims of the given identity.
public static ImmutableDictionary<string, string[]> GetDestinations(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe identity.
Returns
- ImmutableDictionary<string, string[]>
The destinations, returned as a flattened dictionary.
GetDestinations(ClaimsPrincipal)
Gets the destinations associated with all the claims of the given principal.
public static ImmutableDictionary<string, string[]> GetDestinations(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe principal.
Returns
- ImmutableDictionary<string, string[]>
The destinations, returned as a flattened dictionary.
GetDeviceCodeLifetime(ClaimsIdentity)
Gets the device code lifetime associated with the claims identity.
public static TimeSpan? GetDeviceCodeLifetime(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetDeviceCodeLifetime(ClaimsPrincipal)
Gets the device code lifetime associated with the claims principal.
public static TimeSpan? GetDeviceCodeLifetime(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetExpirationDate(ClaimsIdentity)
Gets the expiration date stored in the claims identity.
public static DateTimeOffset? GetExpirationDate(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
- DateTimeOffset?
The expiration date or null if the claim cannot be found.
GetExpirationDate(ClaimsPrincipal)
Gets the expiration date stored in the claims principal.
public static DateTimeOffset? GetExpirationDate(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
- DateTimeOffset?
The expiration date or null if the claim cannot be found.
GetIdentityTokenLifetime(ClaimsIdentity)
Gets the identity token lifetime associated with the claims identity.
public static TimeSpan? GetIdentityTokenLifetime(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetIdentityTokenLifetime(ClaimsPrincipal)
Gets the identity token lifetime associated with the claims principal.
public static TimeSpan? GetIdentityTokenLifetime(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetPresenters(ClaimsIdentity)
Gets the presenters list stored in the claims identity.
public static ImmutableArray<string> GetPresenters(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
- ImmutableArray<string>
The presenters list or an empty set if the claims cannot be found.
GetPresenters(ClaimsPrincipal)
Gets the presenters list stored in the claims principal.
public static ImmutableArray<string> GetPresenters(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
- ImmutableArray<string>
The presenters list or an empty set if the claims cannot be found.
GetPrompts(OpenIddictRequest)
Extracts the prompt values from an OpenIddictRequest.
public static ImmutableArray<string> GetPrompts(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
GetRefreshTokenLifetime(ClaimsIdentity)
Gets the refresh token lifetime associated with the claims identity.
public static TimeSpan? GetRefreshTokenLifetime(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetRefreshTokenLifetime(ClaimsPrincipal)
Gets the refresh token lifetime associated with the claims principal.
public static TimeSpan? GetRefreshTokenLifetime(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetResources(ClaimsIdentity)
Gets the resources list stored in the claims identity.
public static ImmutableArray<string> GetResources(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
- ImmutableArray<string>
The resources list or an empty set if the claims cannot be found.
GetResources(ClaimsPrincipal)
Gets the resources list stored in the claims principal.
public static ImmutableArray<string> GetResources(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
- ImmutableArray<string>
The resources list or an empty set if the claims cannot be found.
GetResponseTypes(OpenIddictRequest)
Extracts the response types from an OpenIddictRequest.
public static ImmutableArray<string> GetResponseTypes(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
GetScopes(OpenIddictRequest)
Extracts the scopes from an OpenIddictRequest.
public static ImmutableArray<string> GetScopes(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
GetScopes(ClaimsIdentity)
Gets the scopes list stored in the claims identity.
public static ImmutableArray<string> GetScopes(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
- ImmutableArray<string>
The scopes list or an empty set if the claim cannot be found.
GetScopes(ClaimsPrincipal)
Gets the scopes list stored in the claims principal.
public static ImmutableArray<string> GetScopes(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
- ImmutableArray<string>
The scopes list or an empty set if the claim cannot be found.
GetStateTokenLifetime(ClaimsIdentity)
Gets the state token lifetime associated with the claims identity.
public static TimeSpan? GetStateTokenLifetime(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetStateTokenLifetime(ClaimsPrincipal)
Gets the state token lifetime associated with the claims principal.
public static TimeSpan? GetStateTokenLifetime(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetTokenId(ClaimsIdentity)
Gets the internal token identifier associated with the claims identity.
public static string? GetTokenId(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetTokenId(ClaimsPrincipal)
Gets the internal token identifier associated with the claims principal.
public static string? GetTokenId(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetTokenType(ClaimsIdentity)
Gets the token type associated with the claims identity.
public static string? GetTokenType(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetTokenType(ClaimsPrincipal)
Gets the token type associated with the claims principal.
public static string? GetTokenType(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
GetUserCodeLifetime(ClaimsIdentity)
Gets the user code lifetime associated with the claims identity.
public static TimeSpan? GetUserCodeLifetime(this ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe claims identity.
Returns
GetUserCodeLifetime(ClaimsPrincipal)
Gets the user code lifetime associated with the claims principal.
public static TimeSpan? GetUserCodeLifetime(this ClaimsPrincipal principal)
Parameters
principalClaimsPrincipalThe claims principal.
Returns
HasAcrValue(OpenIddictRequest, string)
Determines whether the requested authentication context class values contain the specified item.
public static bool HasAcrValue(this OpenIddictRequest request, string value)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
valuestringThe component to look for in the parameter.
Returns
HasAudience(ClaimsIdentity, string)
Determines whether the claims identity contains the given audience.
public static bool HasAudience(this ClaimsIdentity identity, string audience)
Parameters
identityClaimsIdentityThe claims identity.
audiencestringThe audience.
Returns
HasAudience(ClaimsPrincipal, string)
Determines whether the claims principal contains the given audience.
public static bool HasAudience(this ClaimsPrincipal principal, string audience)
Parameters
principalClaimsPrincipalThe claims principal.
audiencestringThe audience.
Returns
HasClaim(ClaimsIdentity, string)
Determines whether the claims identity contains at least one claim of the specified type.
public static bool HasClaim(this ClaimsIdentity identity, string type)
Parameters
identityClaimsIdentityThe claims identity.
typestringThe claim type.
Returns
HasClaim(ClaimsPrincipal, string)
Determines whether the claims principal contains at least one claim of the specified type.
public static bool HasClaim(this ClaimsPrincipal principal, string type)
Parameters
principalClaimsPrincipalThe claims principal.
typestringThe claim type.
Returns
HasDestination(Claim, string)
Determines whether the given claim contains the required destination.
public static bool HasDestination(this Claim claim, string destination)
Parameters
Returns
HasPresenter(ClaimsIdentity, string)
Determines whether the claims identity contains the given presenter.
public static bool HasPresenter(this ClaimsIdentity identity, string presenter)
Parameters
identityClaimsIdentityThe claims identity.
presenterstringThe presenter.
Returns
HasPresenter(ClaimsPrincipal, string)
Determines whether the claims principal contains the given presenter.
public static bool HasPresenter(this ClaimsPrincipal principal, string presenter)
Parameters
principalClaimsPrincipalThe claims principal.
presenterstringThe presenter.
Returns
HasPrompt(OpenIddictRequest, string)
Determines whether the requested prompt contains the specified value.
public static bool HasPrompt(this OpenIddictRequest request, string prompt)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
promptstringThe component to look for in the parameter.
Returns
HasResource(ClaimsIdentity, string)
Determines whether the claims identity contains the given resource.
public static bool HasResource(this ClaimsIdentity identity, string resource)
Parameters
identityClaimsIdentityThe claims identity.
resourcestringThe resource.
Returns
HasResource(ClaimsPrincipal, string)
Determines whether the claims principal contains the given resource.
public static bool HasResource(this ClaimsPrincipal principal, string resource)
Parameters
principalClaimsPrincipalThe claims principal.
resourcestringThe resource.
Returns
HasResponseType(OpenIddictRequest, string)
Determines whether the requested response type contains the specified value.
public static bool HasResponseType(this OpenIddictRequest request, string type)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
typestringThe component to look for in the parameter.
Returns
HasScope(OpenIddictRequest, string)
Determines whether the requested scope contains the specified value.
public static bool HasScope(this OpenIddictRequest request, string scope)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
scopestringThe component to look for in the parameter.
Returns
HasScope(ClaimsIdentity, string)
Determines whether the claims identity contains the given scope.
public static bool HasScope(this ClaimsIdentity identity, string scope)
Parameters
identityClaimsIdentityThe claims identity.
scopestringThe scope.
Returns
HasScope(ClaimsPrincipal, string)
Determines whether the claims principal contains the given scope.
public static bool HasScope(this ClaimsPrincipal principal, string scope)
Parameters
principalClaimsPrincipalThe claims principal.
scopestringThe scope.
Returns
HasTokenType(ClaimsIdentity, string)
Determines whether the token type associated with the claims identity matches the specified type.
public static bool HasTokenType(this ClaimsIdentity identity, string type)
Parameters
identityClaimsIdentityThe claims identity.
typestringThe token type.
Returns
HasTokenType(ClaimsPrincipal, string)
Determines whether the token type associated with the claims principal matches the specified type.
public static bool HasTokenType(this ClaimsPrincipal principal, string type)
Parameters
principalClaimsPrincipalThe claims principal.
typestringThe token type.
Returns
IsAuthorizationCodeFlow(OpenIddictRequest)
Determines whether the "response_type" parameter corresponds to the authorization code flow. See http://tools.ietf.org/html/rfc6749#section-4.1.1 for more information.
public static bool IsAuthorizationCodeFlow(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
IsAuthorizationCodeGrantType(OpenIddictRequest)
Determines whether the "grant_type" parameter corresponds to the authorization code grant. See http://tools.ietf.org/html/rfc6749#section-4.1.3 for more information.
public static bool IsAuthorizationCodeGrantType(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
IsClientCredentialsGrantType(OpenIddictRequest)
Determines whether the "grant_type" parameter corresponds to the client credentials grant. See http://tools.ietf.org/html/rfc6749#section-4.4.2 for more information.
public static bool IsClientCredentialsGrantType(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
IsDeviceCodeGrantType(OpenIddictRequest)
Determines whether the "grant_type" parameter corresponds to the device code grant. See https://tools.ietf.org/html/rfc8628 for more information.
public static bool IsDeviceCodeGrantType(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
IsFormPostResponseMode(OpenIddictRequest)
Determines whether the "response_mode" parameter corresponds to the form post response mode. See http://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html for more information.
public static bool IsFormPostResponseMode(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
- bool
true if the request specified the form post response mode or if it's the default value for the requested flow, false otherwise.
IsFragmentResponseMode(OpenIddictRequest)
Determines whether the "response_mode" parameter corresponds to the fragment response mode. See http://openid.net/specs/oauth-v2-multiple-response-types-1_0.html for more information.
public static bool IsFragmentResponseMode(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
- bool
true if the request specified the fragment response mode or if it's the default value for the requested flow, false otherwise.
IsHybridFlow(OpenIddictRequest)
Determines whether the "response_type" parameter corresponds to the hybrid flow. See http://tools.ietf.org/html/rfc6749#section-4.2.1 and http://openid.net/specs/openid-connect-core-1_0.html for more information.
public static bool IsHybridFlow(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
IsImplicitFlow(OpenIddictRequest)
Determines whether the "response_type" parameter corresponds to the implicit flow. See http://tools.ietf.org/html/rfc6749#section-4.2.1 and http://openid.net/specs/openid-connect-core-1_0.html for more information
public static bool IsImplicitFlow(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
IsNoneFlow(OpenIddictRequest)
Determines whether the "response_type" parameter corresponds to the "none" response type. See http://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#none for more information.
public static bool IsNoneFlow(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
IsPasswordGrantType(OpenIddictRequest)
Determines whether the "grant_type" parameter corresponds to the password grant. See http://tools.ietf.org/html/rfc6749#section-4.3.2 for more information.
public static bool IsPasswordGrantType(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
IsQueryResponseMode(OpenIddictRequest)
Determines whether the "response_mode" parameter corresponds to the query response mode. See http://openid.net/specs/oauth-v2-multiple-response-types-1_0.html for more information.
public static bool IsQueryResponseMode(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
- bool
true if the request specified the query response mode or if it's the default value for the requested flow, false otherwise.
IsRefreshTokenGrantType(OpenIddictRequest)
Determines whether the "grant_type" parameter corresponds to the refresh token grant. See http://tools.ietf.org/html/rfc6749#section-6 for more information.
public static bool IsRefreshTokenGrantType(this OpenIddictRequest request)
Parameters
requestOpenIddictRequestThe OpenIddictRequest instance.
Returns
RemoveClaims(ClaimsIdentity, string)
Removes all the claims corresponding to the given type.
public static ClaimsIdentity RemoveClaims(this ClaimsIdentity identity, string type)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
Returns
- ClaimsIdentity
The claims identity.
RemoveClaims(ClaimsPrincipal, string)
Removes all the claims corresponding to the given type.
public static ClaimsPrincipal RemoveClaims(this ClaimsPrincipal principal, string type)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
Returns
- ClaimsPrincipal
The claims identity.
SetAccessTokenLifetime(ClaimsIdentity, TimeSpan?)
Sets the access token lifetime associated with the claims identity.
public static ClaimsIdentity SetAccessTokenLifetime(this ClaimsIdentity identity, TimeSpan? lifetime)
Parameters
identityClaimsIdentityThe claims identity.
lifetimeTimeSpan?The access token lifetime to store.
Returns
- ClaimsIdentity
The claims identity.
SetAccessTokenLifetime(ClaimsPrincipal, TimeSpan?)
Sets the access token lifetime associated with the claims principal.
public static ClaimsPrincipal SetAccessTokenLifetime(this ClaimsPrincipal principal, TimeSpan? lifetime)
Parameters
principalClaimsPrincipalThe claims principal.
lifetimeTimeSpan?The access token lifetime to store.
Returns
- ClaimsPrincipal
The claims principal.
SetAudiences(ClaimsIdentity, IEnumerable<string>?)
Sets the audiences list in the claims identity. Note: this method automatically excludes duplicate audiences.
public static ClaimsIdentity SetAudiences(this ClaimsIdentity identity, IEnumerable<string>? audiences)
Parameters
identityClaimsIdentityThe claims identity.
audiencesIEnumerable<string>The audiences to store.
Returns
- ClaimsIdentity
The claims identity.
SetAudiences(ClaimsIdentity, ImmutableArray<string>)
Sets the audiences list in the claims identity. Note: this method automatically excludes duplicate audiences.
public static ClaimsIdentity SetAudiences(this ClaimsIdentity identity, ImmutableArray<string> audiences)
Parameters
identityClaimsIdentityThe claims identity.
audiencesImmutableArray<string>The audiences to store.
Returns
- ClaimsIdentity
The claims identity.
SetAudiences(ClaimsIdentity, params string[]?)
Sets the audiences list in the claims identity. Note: this method automatically excludes duplicate audiences.
public static ClaimsIdentity SetAudiences(this ClaimsIdentity identity, params string[]? audiences)
Parameters
identityClaimsIdentityThe claims identity.
audiencesstring[]The audiences to store.
Returns
- ClaimsIdentity
The claims identity.
SetAudiences(ClaimsPrincipal, IEnumerable<string>?)
Sets the audiences list in the claims principal. Note: this method automatically excludes duplicate audiences.
public static ClaimsPrincipal SetAudiences(this ClaimsPrincipal principal, IEnumerable<string>? audiences)
Parameters
principalClaimsPrincipalThe claims principal.
audiencesIEnumerable<string>The audiences to store.
Returns
- ClaimsPrincipal
The claims principal.
SetAudiences(ClaimsPrincipal, ImmutableArray<string>)
Sets the audiences list in the claims principal. Note: this method automatically excludes duplicate audiences.
public static ClaimsPrincipal SetAudiences(this ClaimsPrincipal principal, ImmutableArray<string> audiences)
Parameters
principalClaimsPrincipalThe claims principal.
audiencesImmutableArray<string>The audiences to store.
Returns
- ClaimsPrincipal
The claims principal.
SetAudiences(ClaimsPrincipal, params string[]?)
Sets the audiences list in the claims principal. Note: this method automatically excludes duplicate audiences.
public static ClaimsPrincipal SetAudiences(this ClaimsPrincipal principal, params string[]? audiences)
Parameters
principalClaimsPrincipalThe claims principal.
audiencesstring[]The audiences to store.
Returns
- ClaimsPrincipal
The claims principal.
SetAuthorizationCodeLifetime(ClaimsIdentity, TimeSpan?)
Sets the authorization code lifetime associated with the claims identity.
public static ClaimsIdentity SetAuthorizationCodeLifetime(this ClaimsIdentity identity, TimeSpan? lifetime)
Parameters
identityClaimsIdentityThe claims identity.
lifetimeTimeSpan?The authorization code lifetime to store.
Returns
- ClaimsIdentity
The claims identity.
SetAuthorizationCodeLifetime(ClaimsPrincipal, TimeSpan?)
Sets the authorization code lifetime associated with the claims principal.
public static ClaimsPrincipal SetAuthorizationCodeLifetime(this ClaimsPrincipal principal, TimeSpan? lifetime)
Parameters
principalClaimsPrincipalThe claims principal.
lifetimeTimeSpan?The authorization code lifetime to store.
Returns
- ClaimsPrincipal
The claims principal.
SetAuthorizationId(ClaimsIdentity, string?)
Sets the internal authorization identifier associated with the claims identity.
public static ClaimsIdentity SetAuthorizationId(this ClaimsIdentity identity, string? identifier)
Parameters
identityClaimsIdentityThe claims identity.
identifierstringThe unique identifier to store.
Returns
- ClaimsIdentity
The claims identity.
SetAuthorizationId(ClaimsPrincipal, string?)
Sets the internal authorization identifier associated with the claims principal.
public static ClaimsPrincipal SetAuthorizationId(this ClaimsPrincipal principal, string? identifier)
Parameters
principalClaimsPrincipalThe claims principal.
identifierstringThe unique identifier to store.
Returns
- ClaimsPrincipal
The claims principal.
SetClaim(ClaimsIdentity, string, IDictionary<string, string?>?)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, IDictionary<string, string?>? value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueIDictionary<string, string>The value associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, IDictionary<string, string?>?, string)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, IDictionary<string, string?>? value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueIDictionary<string, string>The value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, bool?)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, bool? value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuebool?The value associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, bool?, string)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, bool? value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuebool?The value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, long?)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, long? value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuelong?The value associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, long?, string)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, long? value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuelong?The value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, string?)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, string? value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuestringThe value associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, string?, string)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, string? value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valuestringThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, JsonElement)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, JsonElement value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueJsonElementThe value associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsIdentity, string, JsonElement, string)
Sets the claim value corresponding to the given type.
public static ClaimsIdentity SetClaim(this ClaimsIdentity identity, string type, JsonElement value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claim.
valueJsonElementThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsIdentity
The claims identity.
SetClaim(ClaimsPrincipal, string, IDictionary<string, string?>?)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, IDictionary<string, string?>? value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueIDictionary<string, string>The value associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, IDictionary<string, string?>?, string)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, IDictionary<string, string?>? value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueIDictionary<string, string>The value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, bool?)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, bool? value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuebool?The value associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, bool?, string)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, bool? value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuebool?The value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, long?)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, long? value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuelong?The value associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, long?, string)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, long? value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuelong?The value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, string?)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, string? value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuestringThe value associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, string?, string)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, string? value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valuestringThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, JsonElement)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, JsonElement value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueJsonElementThe value associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaim(ClaimsPrincipal, string, JsonElement, string)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaim(this ClaimsPrincipal principal, string type, JsonElement value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claim.
valueJsonElementThe value associated with the claim.
issuerstringThe issuer associated with the claim.
Returns
- ClaimsPrincipal
The claims identity.
SetClaims(ClaimsIdentity, string, ImmutableArray<string>)
Sets the claim values corresponding to the given type.
public static ClaimsIdentity SetClaims(this ClaimsIdentity identity, string type, ImmutableArray<string> values)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
valuesImmutableArray<string>The values associated with the claims.
Returns
- ClaimsIdentity
The claims identity.
SetClaims(ClaimsIdentity, string, ImmutableArray<string>, string)
Sets the claim values corresponding to the given type.
public static ClaimsIdentity SetClaims(this ClaimsIdentity identity, string type, ImmutableArray<string> values, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
valuesImmutableArray<string>The values associated with the claims.
issuerstringThe issuer associated with the claims.
Returns
- ClaimsIdentity
The claims identity.
SetClaims(ClaimsIdentity, string, JsonElement)
Sets the claim values corresponding to the given type.
public static ClaimsIdentity SetClaims(this ClaimsIdentity identity, string type, JsonElement value)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
valueJsonElementThe JSON array from which claim values are extracted.
Returns
- ClaimsIdentity
The claims identity.
SetClaims(ClaimsIdentity, string, JsonElement, string)
Sets the claim values corresponding to the given type.
public static ClaimsIdentity SetClaims(this ClaimsIdentity identity, string type, JsonElement value, string issuer)
Parameters
identityClaimsIdentityThe identity.
typestringThe type associated with the claims.
valueJsonElementThe JSON array from which claim values are extracted.
issuerstringThe issuer associated with the claims.
Returns
- ClaimsIdentity
The claims identity.
SetClaims(ClaimsPrincipal, string, ImmutableArray<string>)
Sets the claim values corresponding to the given type.
public static ClaimsPrincipal SetClaims(this ClaimsPrincipal principal, string type, ImmutableArray<string> values)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
valuesImmutableArray<string>The values associated with the claims.
Returns
- ClaimsPrincipal
The claims identity.
SetClaims(ClaimsPrincipal, string, ImmutableArray<string>, string)
Sets the claim values corresponding to the given type.
public static ClaimsPrincipal SetClaims(this ClaimsPrincipal principal, string type, ImmutableArray<string> values, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
valuesImmutableArray<string>The values associated with the claims.
issuerstringThe issuer associated with the claims.
Returns
- ClaimsPrincipal
The claims identity.
SetClaims(ClaimsPrincipal, string, JsonElement)
Sets the claim values corresponding to the given type.
public static ClaimsPrincipal SetClaims(this ClaimsPrincipal principal, string type, JsonElement value)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
valueJsonElementThe JSON array from which claim values are extracted.
Returns
- ClaimsPrincipal
The claims identity.
SetClaims(ClaimsPrincipal, string, JsonElement, string)
Sets the claim value corresponding to the given type.
public static ClaimsPrincipal SetClaims(this ClaimsPrincipal principal, string type, JsonElement value, string issuer)
Parameters
principalClaimsPrincipalThe principal.
typestringThe type associated with the claims.
valueJsonElementThe JSON array from which claim values are extracted.
issuerstringThe issuer associated with the claims.
Returns
- ClaimsPrincipal
The claims identity.
SetCreationDate(ClaimsIdentity, DateTimeOffset?)
Sets the creation date in the claims identity.
public static ClaimsIdentity SetCreationDate(this ClaimsIdentity identity, DateTimeOffset? date)
Parameters
identityClaimsIdentityThe claims identity.
dateDateTimeOffset?The creation date
Returns
- ClaimsIdentity
The claims identity.
SetCreationDate(ClaimsPrincipal, DateTimeOffset?)
Sets the creation date in the claims principal.
public static ClaimsPrincipal SetCreationDate(this ClaimsPrincipal principal, DateTimeOffset? date)
Parameters
principalClaimsPrincipalThe claims principal.
dateDateTimeOffset?The creation date
Returns
- ClaimsPrincipal
The claims principal.
SetDestinations(Claim, IEnumerable<string>?)
Adds specific destinations to a claim.
public static Claim SetDestinations(this Claim claim, IEnumerable<string>? destinations)
Parameters
claimClaimThe Claim instance.
destinationsIEnumerable<string>The destinations.
Returns
SetDestinations(Claim, ImmutableArray<string>)
Adds specific destinations to a claim.
public static Claim SetDestinations(this Claim claim, ImmutableArray<string> destinations)
Parameters
claimClaimThe Claim instance.
destinationsImmutableArray<string>The destinations.
Returns
SetDestinations(Claim, params string[]?)
Adds specific destinations to a claim.
public static Claim SetDestinations(this Claim claim, params string[]? destinations)
Parameters
Returns
SetDestinations(ClaimsIdentity, ImmutableDictionary<string, string[]>)
Sets the destinations associated with all the claims of the given identity.
public static ClaimsIdentity SetDestinations(this ClaimsIdentity identity, ImmutableDictionary<string, string[]> destinations)
Parameters
identityClaimsIdentityThe identity.
destinationsImmutableDictionary<string, string[]>The destinations, as a flattened dictionary.
Returns
- ClaimsIdentity
The identity.
SetDestinations(ClaimsIdentity, Func<Claim, IEnumerable<string>>)
Sets the destinations associated with all the claims of the given identity.
public static ClaimsIdentity SetDestinations(this ClaimsIdentity identity, Func<Claim, IEnumerable<string>> selector)
Parameters
identityClaimsIdentityThe identity.
selectorFunc<Claim, IEnumerable<string>>The destinations selector delegate.
Returns
- ClaimsIdentity
The identity.
SetDestinations(ClaimsPrincipal, ImmutableDictionary<string, string[]>)
Sets the destinations associated with all the claims of the given principal.
public static ClaimsPrincipal SetDestinations(this ClaimsPrincipal principal, ImmutableDictionary<string, string[]> destinations)
Parameters
principalClaimsPrincipalThe principal.
destinationsImmutableDictionary<string, string[]>The destinations, as a flattened dictionary.
Returns
- ClaimsPrincipal
The principal.
SetDestinations(ClaimsPrincipal, Func<Claim, IEnumerable<string>>)
Sets the destinations associated with all the claims of the given principal.
public static ClaimsPrincipal SetDestinations(this ClaimsPrincipal principal, Func<Claim, IEnumerable<string>> selector)
Parameters
principalClaimsPrincipalThe principal.
selectorFunc<Claim, IEnumerable<string>>The destinations selector delegate.
Returns
- ClaimsPrincipal
The principal.
SetDeviceCodeLifetime(ClaimsIdentity, TimeSpan?)
Sets the device code lifetime associated with the claims identity.
public static ClaimsIdentity SetDeviceCodeLifetime(this ClaimsIdentity identity, TimeSpan? lifetime)
Parameters
identityClaimsIdentityThe claims identity.
lifetimeTimeSpan?The device code lifetime to store.
Returns
- ClaimsIdentity
The claims identity.
SetDeviceCodeLifetime(ClaimsPrincipal, TimeSpan?)
Sets the device code lifetime associated with the claims principal.
public static ClaimsPrincipal SetDeviceCodeLifetime(this ClaimsPrincipal principal, TimeSpan? lifetime)
Parameters
principalClaimsPrincipalThe claims principal.
lifetimeTimeSpan?The device code lifetime to store.
Returns
- ClaimsPrincipal
The claims principal.
SetExpirationDate(ClaimsIdentity, DateTimeOffset?)
Sets the expiration date in the claims identity.
public static ClaimsIdentity SetExpirationDate(this ClaimsIdentity identity, DateTimeOffset? date)
Parameters
identityClaimsIdentityThe claims identity.
dateDateTimeOffset?The expiration date
Returns
- ClaimsIdentity
The claims identity.
SetExpirationDate(ClaimsPrincipal, DateTimeOffset?)
Sets the expiration date in the claims principal.
public static ClaimsPrincipal SetExpirationDate(this ClaimsPrincipal principal, DateTimeOffset? date)
Parameters
principalClaimsPrincipalThe claims principal.
dateDateTimeOffset?The expiration date
Returns
- ClaimsPrincipal
The claims principal.
SetIdentityTokenLifetime(ClaimsIdentity, TimeSpan?)
Sets the identity token lifetime associated with the claims identity.
public static ClaimsIdentity SetIdentityTokenLifetime(this ClaimsIdentity identity, TimeSpan? lifetime)
Parameters
identityClaimsIdentityThe claims identity.
lifetimeTimeSpan?The identity token lifetime to store.
Returns
- ClaimsIdentity
The claims identity.
SetIdentityTokenLifetime(ClaimsPrincipal, TimeSpan?)
Sets the identity token lifetime associated with the claims principal.
public static ClaimsPrincipal SetIdentityTokenLifetime(this ClaimsPrincipal principal, TimeSpan? lifetime)
Parameters
principalClaimsPrincipalThe claims principal.
lifetimeTimeSpan?The identity token lifetime to store.
Returns
- ClaimsPrincipal
The claims principal.
SetPresenters(ClaimsIdentity, IEnumerable<string>?)
Sets the presenters list in the claims identity. Note: this method automatically excludes duplicate presenters.
public static ClaimsIdentity SetPresenters(this ClaimsIdentity identity, IEnumerable<string>? presenters)
Parameters
identityClaimsIdentityThe claims identity.
presentersIEnumerable<string>The presenters to store.
Returns
- ClaimsIdentity
The claims identity.
SetPresenters(ClaimsIdentity, ImmutableArray<string>)
Sets the presenters list in the claims identity. Note: this method automatically excludes duplicate presenters.
public static ClaimsIdentity SetPresenters(this ClaimsIdentity identity, ImmutableArray<string> presenters)
Parameters
identityClaimsIdentityThe claims identity.
presentersImmutableArray<string>The presenters to store.
Returns
- ClaimsIdentity
The claims identity.
SetPresenters(ClaimsIdentity, params string[]?)
Sets the presenters list in the claims identity. Note: this method automatically excludes duplicate presenters.
public static ClaimsIdentity SetPresenters(this ClaimsIdentity identity, params string[]? presenters)
Parameters
identityClaimsIdentityThe claims identity.
presentersstring[]The presenters to store.
Returns
- ClaimsIdentity
The claims identity.
SetPresenters(ClaimsPrincipal, IEnumerable<string>?)
Sets the presenters list in the claims principal. Note: this method automatically excludes duplicate presenters.
public static ClaimsPrincipal SetPresenters(this ClaimsPrincipal principal, IEnumerable<string>? presenters)
Parameters
principalClaimsPrincipalThe claims principal.
presentersIEnumerable<string>The presenters to store.
Returns
- ClaimsPrincipal
The claims principal.
SetPresenters(ClaimsPrincipal, ImmutableArray<string>)
Sets the presenters list in the claims principal. Note: this method automatically excludes duplicate presenters.
public static ClaimsPrincipal SetPresenters(this ClaimsPrincipal principal, ImmutableArray<string> presenters)
Parameters
principalClaimsPrincipalThe claims principal.
presentersImmutableArray<string>The presenters to store.
Returns
- ClaimsPrincipal
The claims principal.
SetPresenters(ClaimsPrincipal, params string[]?)
Sets the presenters list in the claims principal. Note: this method automatically excludes duplicate presenters.
public static ClaimsPrincipal SetPresenters(this ClaimsPrincipal principal, params string[]? presenters)
Parameters
principalClaimsPrincipalThe claims principal.
presentersstring[]The presenters to store.
Returns
- ClaimsPrincipal
The claims principal.
SetRefreshTokenLifetime(ClaimsIdentity, TimeSpan?)
Sets the refresh token lifetime associated with the claims identity.
public static ClaimsIdentity SetRefreshTokenLifetime(this ClaimsIdentity identity, TimeSpan? lifetime)
Parameters
identityClaimsIdentityThe claims identity.
lifetimeTimeSpan?The refresh token lifetime to store.
Returns
- ClaimsIdentity
The claims identity.
SetRefreshTokenLifetime(ClaimsPrincipal, TimeSpan?)
Sets the refresh token lifetime associated with the claims principal.
public static ClaimsPrincipal SetRefreshTokenLifetime(this ClaimsPrincipal principal, TimeSpan? lifetime)
Parameters
principalClaimsPrincipalThe claims principal.
lifetimeTimeSpan?The refresh token lifetime to store.
Returns
- ClaimsPrincipal
The claims principal.
SetResources(ClaimsIdentity, IEnumerable<string>?)
Sets the resources list in the claims identity. Note: this method automatically excludes duplicate resources.
public static ClaimsIdentity SetResources(this ClaimsIdentity identity, IEnumerable<string>? resources)
Parameters
identityClaimsIdentityThe claims identity.
resourcesIEnumerable<string>The resources to store.
Returns
- ClaimsIdentity
The claims identity.
SetResources(ClaimsIdentity, ImmutableArray<string>)
Sets the resources list in the claims identity. Note: this method automatically excludes duplicate resources.
public static ClaimsIdentity SetResources(this ClaimsIdentity identity, ImmutableArray<string> resources)
Parameters
identityClaimsIdentityThe claims identity.
resourcesImmutableArray<string>The resources to store.
Returns
- ClaimsIdentity
The claims identity.
SetResources(ClaimsIdentity, params string[]?)
Sets the resources list in the claims identity. Note: this method automatically excludes duplicate resources.
public static ClaimsIdentity SetResources(this ClaimsIdentity identity, params string[]? resources)
Parameters
identityClaimsIdentityThe claims identity.
resourcesstring[]The resources to store.
Returns
- ClaimsIdentity
The claims identity.
SetResources(ClaimsPrincipal, IEnumerable<string>?)
Sets the resources list in the claims principal. Note: this method automatically excludes duplicate resources.
public static ClaimsPrincipal SetResources(this ClaimsPrincipal principal, IEnumerable<string>? resources)
Parameters
principalClaimsPrincipalThe claims principal.
resourcesIEnumerable<string>The resources to store.
Returns
- ClaimsPrincipal
The claims principal.
SetResources(ClaimsPrincipal, ImmutableArray<string>)
Sets the resources list in the claims principal. Note: this method automatically excludes duplicate resources.
public static ClaimsPrincipal SetResources(this ClaimsPrincipal principal, ImmutableArray<string> resources)
Parameters
principalClaimsPrincipalThe claims principal.
resourcesImmutableArray<string>The resources to store.
Returns
- ClaimsPrincipal
The claims principal.
SetResources(ClaimsPrincipal, params string[]?)
Sets the resources list in the claims principal. Note: this method automatically excludes duplicate resources.
public static ClaimsPrincipal SetResources(this ClaimsPrincipal principal, params string[]? resources)
Parameters
principalClaimsPrincipalThe claims principal.
resourcesstring[]The resources to store.
Returns
- ClaimsPrincipal
The claims principal.
SetScopes(ClaimsIdentity, IEnumerable<string>?)
Sets the scopes list in the claims identity. Note: this method automatically excludes duplicate scopes.
public static ClaimsIdentity SetScopes(this ClaimsIdentity identity, IEnumerable<string>? scopes)
Parameters
identityClaimsIdentityThe claims identity.
scopesIEnumerable<string>The scopes to store.
Returns
- ClaimsIdentity
The claims identity.
SetScopes(ClaimsIdentity, ImmutableArray<string>)
Sets the scopes list in the claims identity. Note: this method automatically excludes duplicate scopes.
public static ClaimsIdentity SetScopes(this ClaimsIdentity identity, ImmutableArray<string> scopes)
Parameters
identityClaimsIdentityThe claims identity.
scopesImmutableArray<string>The scopes to store.
Returns
- ClaimsIdentity
The claims identity.
SetScopes(ClaimsIdentity, params string[]?)
Sets the scopes list in the claims identity. Note: this method automatically excludes duplicate scopes.
public static ClaimsIdentity SetScopes(this ClaimsIdentity identity, params string[]? scopes)
Parameters
identityClaimsIdentityThe claims identity.
scopesstring[]The scopes to store.
Returns
- ClaimsIdentity
The claims identity.
SetScopes(ClaimsPrincipal, IEnumerable<string>?)
Sets the scopes list in the claims principal. Note: this method automatically excludes duplicate scopes.
public static ClaimsPrincipal SetScopes(this ClaimsPrincipal principal, IEnumerable<string>? scopes)
Parameters
principalClaimsPrincipalThe claims principal.
scopesIEnumerable<string>The scopes to store.
Returns
- ClaimsPrincipal
The claims principal.
SetScopes(ClaimsPrincipal, ImmutableArray<string>)
Sets the scopes list in the claims principal. Note: this method automatically excludes duplicate scopes.
public static ClaimsPrincipal SetScopes(this ClaimsPrincipal principal, ImmutableArray<string> scopes)
Parameters
principalClaimsPrincipalThe claims principal.
scopesImmutableArray<string>The scopes to store.
Returns
- ClaimsPrincipal
The claims principal.
SetScopes(ClaimsPrincipal, params string[]?)
Sets the scopes list in the claims principal. Note: this method automatically excludes duplicate scopes.
public static ClaimsPrincipal SetScopes(this ClaimsPrincipal principal, params string[]? scopes)
Parameters
principalClaimsPrincipalThe claims principal.
scopesstring[]The scopes to store.
Returns
- ClaimsPrincipal
The claims principal.
SetStateTokenLifetime(ClaimsIdentity, TimeSpan?)
Sets the state token lifetime associated with the claims identity.
public static ClaimsIdentity SetStateTokenLifetime(this ClaimsIdentity identity, TimeSpan? lifetime)
Parameters
identityClaimsIdentityThe claims identity.
lifetimeTimeSpan?The state token lifetime to store.
Returns
- ClaimsIdentity
The claims identity.
SetStateTokenLifetime(ClaimsPrincipal, TimeSpan?)
Sets the state token lifetime associated with the claims principal.
public static ClaimsPrincipal SetStateTokenLifetime(this ClaimsPrincipal principal, TimeSpan? lifetime)
Parameters
principalClaimsPrincipalThe claims principal.
lifetimeTimeSpan?The state token lifetime to store.
Returns
- ClaimsPrincipal
The claims principal.
SetTokenId(ClaimsIdentity, string?)
Sets the internal token identifier associated with the claims identity.
public static ClaimsIdentity SetTokenId(this ClaimsIdentity identity, string? identifier)
Parameters
identityClaimsIdentityThe claims identity.
identifierstringThe unique identifier to store.
Returns
- ClaimsIdentity
The claims identity.
SetTokenId(ClaimsPrincipal, string?)
Sets the internal token identifier associated with the claims principal.
public static ClaimsPrincipal SetTokenId(this ClaimsPrincipal principal, string? identifier)
Parameters
principalClaimsPrincipalThe claims principal.
identifierstringThe unique identifier to store.
Returns
- ClaimsPrincipal
The claims principal.
SetTokenType(ClaimsIdentity, string?)
Sets the token type associated with the claims identity.
public static ClaimsIdentity SetTokenType(this ClaimsIdentity identity, string? type)
Parameters
identityClaimsIdentityThe claims identity.
typestringThe token type to store.
Returns
- ClaimsIdentity
The claims identity.
SetTokenType(ClaimsPrincipal, string?)
Sets the token type associated with the claims principal.
public static ClaimsPrincipal SetTokenType(this ClaimsPrincipal principal, string? type)
Parameters
principalClaimsPrincipalThe claims principal.
typestringThe token type to store.
Returns
- ClaimsPrincipal
The claims principal.
SetUserCodeLifetime(ClaimsIdentity, TimeSpan?)
Sets the user code lifetime associated with the claims identity.
public static ClaimsIdentity SetUserCodeLifetime(this ClaimsIdentity identity, TimeSpan? lifetime)
Parameters
identityClaimsIdentityThe claims identity.
lifetimeTimeSpan?The user code lifetime to store.
Returns
- ClaimsIdentity
The claims identity.
SetUserCodeLifetime(ClaimsPrincipal, TimeSpan?)
Sets the user code lifetime associated with the claims principal.
public static ClaimsPrincipal SetUserCodeLifetime(this ClaimsPrincipal principal, TimeSpan? lifetime)
Parameters
principalClaimsPrincipalThe claims principal.
lifetimeTimeSpan?The user code lifetime to store.
Returns
- ClaimsPrincipal
The claims principal.