Table of Contents

Class AuthorityOptionsExtension

Namespace
Arc4u.OAuth2.Extensions
Assembly
Arc4u.OAuth2.dll

Registers the AuthorityOptions of the identity providers. The authorities are named options; the one used by default is named Default.

public static class AuthorityOptionsExtension
Inheritance
AuthorityOptionsExtension
Inherited Members

Methods

AddAuthority(IServiceCollection, Action<AuthorityOptions>, string)

Registers a named authority from code.

public static void AddAuthority(this IServiceCollection services, Action<AuthorityOptions> options, string optionKey)

Parameters

services IServiceCollection

The service collection.

options Action<AuthorityOptions>

The action that configures the authority.

optionKey string

The name of the authority. Token providers select it with the Authority key of their settings.

Exceptions

ArgumentNullException

services or options is null, or optionKey is empty.

AddDefaultAuthority(IServiceCollection, IConfiguration, string)

Registers the authority named Default from a configuration section.

public static void AddDefaultAuthority(this IServiceCollection services, IConfiguration configuration, string sectionName = "Authentication:DefaultAuthority")

Parameters

services IServiceCollection

The service collection.

configuration IConfiguration

The configuration.

sectionName string

The section describing the authority (Url, TokenEndpoint, Issuer, MetaDataAddress). The default is Authentication:DefaultAuthority.

Examples

services.AddDefaultAuthority(configuration);

Exceptions

ConfigurationException

The section does not exist or cannot be bound.

AddDefaultAuthority(IServiceCollection, Action<AuthorityOptions>)

Registers the authority named Default from code.

public static void AddDefaultAuthority(this IServiceCollection services, Action<AuthorityOptions> options)

Parameters

services IServiceCollection

The service collection.

options Action<AuthorityOptions>

The action that configures the authority.

Examples

services.AddDefaultAuthority(o => o.SetData(new Uri("https://login.example.com/tenant"), null, null, null));