Table of Contents

Class OAuth2SettingsExtension

Namespace
Arc4u.OAuth2.Extensions
Assembly
Arc4u.OAuth2.AspNetCore.Authentication.dll

Registers the OAuth2SettingsOption as the key/value settings read by the token providers.

public static class OAuth2SettingsExtension
Inheritance
OAuth2SettingsExtension
Inherited Members

Methods

ConfigureOAuth2Settings(IServiceCollection, IConfiguration, string, string)

Reads the OAuth2 settings from a configuration section and registers them as the named SimpleKeyValueSettings sectionKey.

public static SimpleKeyValueSettings ConfigureOAuth2Settings(this IServiceCollection services, IConfiguration configuration, string sectionName, string sectionKey = "OAuth2")

Parameters

services IServiceCollection

The service collection.

configuration IConfiguration

The configuration.

sectionName string

The section holding the OAuth2SettingsOption, for example Authentication:OAuth2.Settings.

sectionKey string

The name of the settings. The default is BearerAuthenticationType (OAuth2).

Returns

SimpleKeyValueSettings

The settings registered.

Exceptions

ConfigurationException

The provider id is empty, or no audience is given while ValidateAudience is true.

ConfigureOAuth2Settings(IServiceCollection, Action<OAuth2SettingsOption>, string)

Validates the OAuth2 settings and registers them as the named SimpleKeyValueSettings sectionKey. When an authority is set, it is registered as the named authority OAuth2.

public static SimpleKeyValueSettings ConfigureOAuth2Settings(this IServiceCollection services, Action<OAuth2SettingsOption> option, string sectionKey = "OAuth2")

Parameters

services IServiceCollection

The service collection.

option Action<OAuth2SettingsOption>

The action that configures the settings.

sectionKey string

The name of the settings. The default is BearerAuthenticationType (OAuth2).

Returns

SimpleKeyValueSettings

The settings registered.

Exceptions

ConfigurationException

The provider id is empty, or no audience is given while ValidateAudience is true.