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
servicesIServiceCollectionThe service collection.
optionsAction<AuthorityOptions>The action that configures the authority.
optionKeystringThe name of the authority. Token providers select it with the
Authoritykey of their settings.
Exceptions
- ArgumentNullException
servicesoroptionsis null, oroptionKeyis 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
servicesIServiceCollectionThe service collection.
configurationIConfigurationThe configuration.
sectionNamestringThe section describing the authority (
Url,TokenEndpoint,Issuer,MetaDataAddress). The default isAuthentication: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
servicesIServiceCollectionThe service collection.
optionsAction<AuthorityOptions>The action that configures the authority.
Examples
services.AddDefaultAuthority(o => o.SetData(new Uri("https://login.example.com/tenant"), null, null, null));