Table of Contents

Class AuthorityOptions

Namespace
Arc4u.OAuth2.Options
Assembly
Arc4u.OAuth2.dll

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

url Uri

The base url of the authority.

tokenEndpoint Uri

The token endpoint, or null to discover it from the metadata.

issuer Uri

The issuer, or null to discover it from the metadata.

metadataAddress Uri

The metadata address, or null to use the standard .well-known/openid-configuration path below url.

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

Uri

IsLocalHost

Gets a value indicating whether the host of Url is localhost, 127.0.0.1 or ::1.

public bool IsLocalHost { get; }

Property Value

bool

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

Uri

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

Uri

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

TimeSpan?

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

Uri

Url

Gets or sets the base url of the authority.

public Uri Url { get; set; }

Property Value

Uri

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

cancellationToken CancellationToken

A 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_endpoint is 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

cancellationToken CancellationToken

A token to cancel the metadata request.

Returns

Task<Uri>

The token endpoint.

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

cancellationToken CancellationToken

A token to cancel the metadata request.

Returns

Task<Uri>

The issuer, which is the access_token_issuer of the metadata when present, otherwise its issuer.

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

url Uri

The base url of the authority.

tokenEndpoint Uri

The token endpoint, or null to discover it from the metadata.

issuer Uri

The issuer, or null to discover it from the metadata.

metadataAddress Uri

The metadata address, or null to use the standard .well-known/openid-configuration path below url.