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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
boolThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
boolThe value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
IDictionary<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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
IDictionary<string, string>The value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
longThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
longThe value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
stringThe value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
JsonElementThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
JsonElementThe value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
boolThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
boolThe value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
IDictionary<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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
IDictionary<string, string>The value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
longThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
longThe value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
stringThe value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
JsonElementThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
JsonElementThe value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claims.
values
ImmutableArray<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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claims.
values
ImmutableArray<string>The values associated with the claims.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claims.
value
JsonElementThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claims.
value
JsonElementThe value associated with the claims.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claims.
values
ImmutableArray<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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claims.
values
ImmutableArray<string>The values associated with the claims.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claims.
value
JsonElementThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claims.
value
JsonElementThe value associated with the claims.
issuer
stringThe 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
identity
ClaimsIdentityThe ClaimsIdentity instance to filter.
filter
Func<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
principal
ClaimsPrincipalThe ClaimsPrincipal instance to filter.
filter
Func<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
identity
ClaimsIdentityThe claims identity.
Returns
GetAccessTokenLifetime(ClaimsPrincipal)
Gets the access token lifetime associated with the claims principal.
public static TimeSpan? GetAccessTokenLifetime(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe claims principal.
Returns
GetAcrValues(OpenIddictRequest)
Extracts the authentication context class values from an OpenIddictRequest.
public static ImmutableArray<string> GetAcrValues(this OpenIddictRequest request)
Parameters
request
OpenIddictRequestThe OpenIddictRequest instance.
Returns
GetAudiences(ClaimsIdentity)
Gets the audiences list stored in the claims identity.
public static ImmutableArray<string> GetAudiences(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe 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
principal
ClaimsPrincipalThe 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
identity
ClaimsIdentityThe claims identity.
Returns
GetAuthorizationCodeLifetime(ClaimsPrincipal)
Gets the authorization code lifetime associated with the claims principal.
public static TimeSpan? GetAuthorizationCodeLifetime(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe claims principal.
Returns
GetAuthorizationId(ClaimsIdentity)
Gets the internal authorization identifier associated with the claims identity.
public static string? GetAuthorizationId(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe claims identity.
Returns
GetAuthorizationId(ClaimsPrincipal)
Gets the internal authorization identifier associated with the claims principal.
public static string? GetAuthorizationId(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
Returns
- string
The claim value.
Exceptions
- InvalidOperationException
Multiple claims using the same
type
are 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
Returns
- string
The claim value.
Exceptions
- InvalidOperationException
Multiple claims using the same
type
are 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
identity
ClaimsIdentityThe claims identity.
type
stringThe 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
principal
ClaimsPrincipalThe claims principal.
type
stringThe 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
identity
ClaimsIdentityThe 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
principal
ClaimsPrincipalThe 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
identity
ClaimsIdentityThe 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
principal
ClaimsPrincipalThe 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
identity
ClaimsIdentityThe claims identity.
Returns
GetDeviceCodeLifetime(ClaimsPrincipal)
Gets the device code lifetime associated with the claims principal.
public static TimeSpan? GetDeviceCodeLifetime(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe claims principal.
Returns
GetExpirationDate(ClaimsIdentity)
Gets the expiration date stored in the claims identity.
public static DateTimeOffset? GetExpirationDate(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe 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
principal
ClaimsPrincipalThe 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
identity
ClaimsIdentityThe claims identity.
Returns
GetIdentityTokenLifetime(ClaimsPrincipal)
Gets the identity token lifetime associated with the claims principal.
public static TimeSpan? GetIdentityTokenLifetime(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe claims principal.
Returns
GetPresenters(ClaimsIdentity)
Gets the presenters list stored in the claims identity.
public static ImmutableArray<string> GetPresenters(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe 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
principal
ClaimsPrincipalThe 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
request
OpenIddictRequestThe OpenIddictRequest instance.
Returns
GetRefreshTokenLifetime(ClaimsIdentity)
Gets the refresh token lifetime associated with the claims identity.
public static TimeSpan? GetRefreshTokenLifetime(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe claims identity.
Returns
GetRefreshTokenLifetime(ClaimsPrincipal)
Gets the refresh token lifetime associated with the claims principal.
public static TimeSpan? GetRefreshTokenLifetime(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe claims principal.
Returns
GetResources(ClaimsIdentity)
Gets the resources list stored in the claims identity.
public static ImmutableArray<string> GetResources(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe 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
principal
ClaimsPrincipalThe 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
request
OpenIddictRequestThe OpenIddictRequest instance.
Returns
GetScopes(OpenIddictRequest)
Extracts the scopes from an OpenIddictRequest.
public static ImmutableArray<string> GetScopes(this OpenIddictRequest request)
Parameters
request
OpenIddictRequestThe OpenIddictRequest instance.
Returns
GetScopes(ClaimsIdentity)
Gets the scopes list stored in the claims identity.
public static ImmutableArray<string> GetScopes(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe 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
principal
ClaimsPrincipalThe 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
identity
ClaimsIdentityThe claims identity.
Returns
GetStateTokenLifetime(ClaimsPrincipal)
Gets the state token lifetime associated with the claims principal.
public static TimeSpan? GetStateTokenLifetime(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe claims principal.
Returns
GetTokenId(ClaimsIdentity)
Gets the internal token identifier associated with the claims identity.
public static string? GetTokenId(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe claims identity.
Returns
GetTokenId(ClaimsPrincipal)
Gets the internal token identifier associated with the claims principal.
public static string? GetTokenId(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe claims principal.
Returns
GetTokenType(ClaimsIdentity)
Gets the token type associated with the claims identity.
public static string? GetTokenType(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe claims identity.
Returns
GetTokenType(ClaimsPrincipal)
Gets the token type associated with the claims principal.
public static string? GetTokenType(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe claims principal.
Returns
GetUserCodeLifetime(ClaimsIdentity)
Gets the user code lifetime associated with the claims identity.
public static TimeSpan? GetUserCodeLifetime(this ClaimsIdentity identity)
Parameters
identity
ClaimsIdentityThe claims identity.
Returns
GetUserCodeLifetime(ClaimsPrincipal)
Gets the user code lifetime associated with the claims principal.
public static TimeSpan? GetUserCodeLifetime(this ClaimsPrincipal principal)
Parameters
principal
ClaimsPrincipalThe 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
request
OpenIddictRequestThe OpenIddictRequest instance.
value
stringThe 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
identity
ClaimsIdentityThe claims identity.
audience
stringThe audience.
Returns
HasAudience(ClaimsPrincipal, string)
Determines whether the claims principal contains the given audience.
public static bool HasAudience(this ClaimsPrincipal principal, string audience)
Parameters
principal
ClaimsPrincipalThe claims principal.
audience
stringThe 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
identity
ClaimsIdentityThe claims identity.
type
stringThe 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
principal
ClaimsPrincipalThe claims principal.
type
stringThe 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
identity
ClaimsIdentityThe claims identity.
presenter
stringThe presenter.
Returns
HasPresenter(ClaimsPrincipal, string)
Determines whether the claims principal contains the given presenter.
public static bool HasPresenter(this ClaimsPrincipal principal, string presenter)
Parameters
principal
ClaimsPrincipalThe claims principal.
presenter
stringThe presenter.
Returns
HasPrompt(OpenIddictRequest, string)
Determines whether the requested prompt contains the specified value.
public static bool HasPrompt(this OpenIddictRequest request, string prompt)
Parameters
request
OpenIddictRequestThe OpenIddictRequest instance.
prompt
stringThe 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
identity
ClaimsIdentityThe claims identity.
resource
stringThe resource.
Returns
HasResource(ClaimsPrincipal, string)
Determines whether the claims principal contains the given resource.
public static bool HasResource(this ClaimsPrincipal principal, string resource)
Parameters
principal
ClaimsPrincipalThe claims principal.
resource
stringThe 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
request
OpenIddictRequestThe OpenIddictRequest instance.
type
stringThe 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
request
OpenIddictRequestThe OpenIddictRequest instance.
scope
stringThe 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
identity
ClaimsIdentityThe claims identity.
scope
stringThe scope.
Returns
HasScope(ClaimsPrincipal, string)
Determines whether the claims principal contains the given scope.
public static bool HasScope(this ClaimsPrincipal principal, string scope)
Parameters
principal
ClaimsPrincipalThe claims principal.
scope
stringThe 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
identity
ClaimsIdentityThe claims identity.
type
stringThe 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
principal
ClaimsPrincipalThe claims principal.
type
stringThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
request
OpenIddictRequestThe 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
identity
ClaimsIdentityThe identity.
type
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe 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
identity
ClaimsIdentityThe claims identity.
lifetime
TimeSpan?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
principal
ClaimsPrincipalThe claims principal.
lifetime
TimeSpan?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
identity
ClaimsIdentityThe claims identity.
audiences
IEnumerable<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
identity
ClaimsIdentityThe claims identity.
audiences
ImmutableArray<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
identity
ClaimsIdentityThe claims identity.
audiences
string[]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
principal
ClaimsPrincipalThe claims principal.
audiences
IEnumerable<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
principal
ClaimsPrincipalThe claims principal.
audiences
ImmutableArray<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
principal
ClaimsPrincipalThe claims principal.
audiences
string[]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
identity
ClaimsIdentityThe claims identity.
lifetime
TimeSpan?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
principal
ClaimsPrincipalThe claims principal.
lifetime
TimeSpan?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
identity
ClaimsIdentityThe claims identity.
identifier
stringThe 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
principal
ClaimsPrincipalThe claims principal.
identifier
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
IDictionary<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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
IDictionary<string, string>The value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
bool?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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
bool?The value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
long?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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
long?The value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
stringThe value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
JsonElementThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claim.
value
JsonElementThe value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
IDictionary<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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
IDictionary<string, string>The value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
bool?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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
bool?The value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
long?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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
long?The value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
stringThe value associated with the claim.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
JsonElementThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claim.
value
JsonElementThe value associated with the claim.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claims.
values
ImmutableArray<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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claims.
values
ImmutableArray<string>The values associated with the claims.
issuer
stringThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claims.
value
JsonElementThe 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
identity
ClaimsIdentityThe identity.
type
stringThe type associated with the claims.
value
JsonElementThe JSON array from which claim values are extracted.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claims.
values
ImmutableArray<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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claims.
values
ImmutableArray<string>The values associated with the claims.
issuer
stringThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claims.
value
JsonElementThe 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
principal
ClaimsPrincipalThe principal.
type
stringThe type associated with the claims.
value
JsonElementThe JSON array from which claim values are extracted.
issuer
stringThe 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
identity
ClaimsIdentityThe claims identity.
date
DateTimeOffset?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
principal
ClaimsPrincipalThe claims principal.
date
DateTimeOffset?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
claim
ClaimThe Claim instance.
destinations
IEnumerable<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
claim
ClaimThe Claim instance.
destinations
ImmutableArray<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
identity
ClaimsIdentityThe identity.
destinations
ImmutableDictionary<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
identity
ClaimsIdentityThe identity.
selector
Func<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
principal
ClaimsPrincipalThe principal.
destinations
ImmutableDictionary<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
principal
ClaimsPrincipalThe principal.
selector
Func<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
identity
ClaimsIdentityThe claims identity.
lifetime
TimeSpan?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
principal
ClaimsPrincipalThe claims principal.
lifetime
TimeSpan?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
identity
ClaimsIdentityThe claims identity.
date
DateTimeOffset?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
principal
ClaimsPrincipalThe claims principal.
date
DateTimeOffset?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
identity
ClaimsIdentityThe claims identity.
lifetime
TimeSpan?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
principal
ClaimsPrincipalThe claims principal.
lifetime
TimeSpan?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
identity
ClaimsIdentityThe claims identity.
presenters
IEnumerable<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
identity
ClaimsIdentityThe claims identity.
presenters
ImmutableArray<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
identity
ClaimsIdentityThe claims identity.
presenters
string[]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
principal
ClaimsPrincipalThe claims principal.
presenters
IEnumerable<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
principal
ClaimsPrincipalThe claims principal.
presenters
ImmutableArray<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
principal
ClaimsPrincipalThe claims principal.
presenters
string[]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
identity
ClaimsIdentityThe claims identity.
lifetime
TimeSpan?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
principal
ClaimsPrincipalThe claims principal.
lifetime
TimeSpan?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
identity
ClaimsIdentityThe claims identity.
resources
IEnumerable<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
identity
ClaimsIdentityThe claims identity.
resources
ImmutableArray<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
identity
ClaimsIdentityThe claims identity.
resources
string[]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
principal
ClaimsPrincipalThe claims principal.
resources
IEnumerable<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
principal
ClaimsPrincipalThe claims principal.
resources
ImmutableArray<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
principal
ClaimsPrincipalThe claims principal.
resources
string[]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
identity
ClaimsIdentityThe claims identity.
scopes
IEnumerable<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
identity
ClaimsIdentityThe claims identity.
scopes
ImmutableArray<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
identity
ClaimsIdentityThe claims identity.
scopes
string[]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
principal
ClaimsPrincipalThe claims principal.
scopes
IEnumerable<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
principal
ClaimsPrincipalThe claims principal.
scopes
ImmutableArray<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
principal
ClaimsPrincipalThe claims principal.
scopes
string[]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
identity
ClaimsIdentityThe claims identity.
lifetime
TimeSpan?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
principal
ClaimsPrincipalThe claims principal.
lifetime
TimeSpan?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
identity
ClaimsIdentityThe claims identity.
identifier
stringThe 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
principal
ClaimsPrincipalThe claims principal.
identifier
stringThe 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
identity
ClaimsIdentityThe claims identity.
type
stringThe 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
principal
ClaimsPrincipalThe claims principal.
type
stringThe 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
identity
ClaimsIdentityThe claims identity.
lifetime
TimeSpan?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
principal
ClaimsPrincipalThe claims principal.
lifetime
TimeSpan?The user code lifetime to store.
Returns
- ClaimsPrincipal
The claims principal.