Class AuthorityOptions
Describes an OpenID Connect authority (identity provider) and its endpoints.
Endpoints that are not set explicitly are discovered from the metadata document (.well-known/openid-configuration) of the authority.
public class AuthorityOptions
- Inheritance
-
AuthorityOptions
- Inherited Members
Constructors
AuthorityOptions()
For Serialization.
public AuthorityOptions()
AuthorityOptions(Uri, Uri?, Uri?, Uri?)
Initializes a new instance of the AuthorityOptions class.
public AuthorityOptions(Uri url, Uri? tokenEndpoint, Uri? issuer, Uri? metadataAddress)
Parameters
urlUriThe base url of the authority.
tokenEndpointUriThe token endpoint, or null to discover it from the metadata.
issuerUriThe issuer, or null to discover it from the metadata.
metadataAddressUriThe metadata address, or null to use the standard
.well-known/openid-configurationpath belowurl.
Properties
EndSessionEndpoint
Gets or sets the end session (sign-out) endpoint. When null it is read from the metadata by GetEndSessionEndpointAsync(CancellationToken).
public Uri? EndSessionEndpoint { get; set; }
Property Value
IsLocalHost
Gets a value indicating whether the host of Url is localhost, 127.0.0.1 or ::1.
public bool IsLocalHost { get; }
Property Value
Issuer
Gets or sets the issuer of the access tokens. When null it is read from the metadata by GetIssuerAsync(CancellationToken).
public Uri? Issuer { get; set; }
Property Value
MetaDataAddress
Gets or sets the address of the OpenID Connect metadata document. When null, GetMetaDataAddress() builds it from Url.
public Uri? MetaDataAddress { get; set; }
Property Value
RetryInterval
Gets or sets the maximum time during which a failing token request is retried. When null the token providers use 90 seconds.
public TimeSpan? RetryInterval { get; set; }
Property Value
TokenEndpoint
Gets or sets the token endpoint. When null it is read from the metadata by GetEndpointAsync(CancellationToken).
public Uri? TokenEndpoint { get; set; }
Property Value
Url
Gets or sets the base url of the authority.
public Uri Url { get; set; }
Property Value
Methods
GetEndSessionEndpointAsync(CancellationToken)
Gets the end session endpoint, downloading the metadata document when it is not yet known. The metadata also fills TokenEndpoint and Issuer.
public Task<Uri?> GetEndSessionEndpointAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token to cancel the metadata request.
Returns
- Task<Uri>
The end session endpoint, or null when the identity provider does not publish one (
end_session_endpointis optional in the metadata).
GetEndpointAsync(CancellationToken)
Gets the token endpoint, downloading the metadata document when it is not yet known. The metadata also fills EndSessionEndpoint and Issuer.
public Task<Uri> GetEndpointAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token to cancel the metadata request.
Returns
GetIssuerAsync(CancellationToken)
Gets the issuer, downloading the metadata document when it is not yet known. The metadata also fills TokenEndpoint and EndSessionEndpoint.
public Task<Uri> GetIssuerAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token to cancel the metadata request.
Returns
- Task<Uri>
The issuer, which is the
access_token_issuerof the metadata when present, otherwise itsissuer.
GetMetaDataAddress()
Gets the address of the OpenID Connect metadata document. When MetaDataAddress is not set, the standard
discovery path (/.well-known/openid-configuration) is appended to Url and stored in MetaDataAddress.
If the authority uses another path, provide the full metadata address.
public Uri GetMetaDataAddress()
Returns
- Uri
The address of the metadata document.
GetRelativeMetaDataAddress()
Gets the metadata address relative to Url, for authorities whose metadata path does not follow the standard.
public string GetRelativeMetaDataAddress()
Returns
- string
The MetaDataAddress with the Url part removed.
SetData(Uri, Uri?, Uri?, Uri?)
Sets the base url and the optional endpoints of the authority.
public void SetData(Uri url, Uri? tokenEndpoint, Uri? issuer, Uri? metadataAddress)
Parameters
urlUriThe base url of the authority.
tokenEndpointUriThe token endpoint, or null to discover it from the metadata.
issuerUriThe issuer, or null to discover it from the metadata.
metadataAddressUriThe metadata address, or null to use the standard
.well-known/openid-configurationpath belowurl.