Table of Contents

Class TokenCacheExtension

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

Registers the TokenCacheOptions.

public static class TokenCacheExtension
Inheritance
TokenCacheExtension
Inherited Members

Methods

AddTokenCache(IServiceCollection, IConfiguration, string)

Registers the token cache options from a configuration section.

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

Parameters

services IServiceCollection

The service collection.

configuration IConfiguration

The configuration.

sectionName string

The section to bind. The default is Authentication:TokenCache. MaxTime keeps its default (50 minutes) when it is not in the section.

Examples

services.AddTokenCache(configuration);

Exceptions

ConfigurationException

CacheName is empty or MaxTime is zero.

AddTokenCache(IServiceCollection, Action<TokenCacheOptions>)

Registers the token cache options from code.

public static void AddTokenCache(this IServiceCollection services, Action<TokenCacheOptions> options)

Parameters

services IServiceCollection

The service collection.

options Action<TokenCacheOptions>

The action that configures the options.

Examples

services.AddTokenCache(o =>
{
    o.CacheName = "Token";
    o.MaxTime = TimeSpan.FromMinutes(30);
});

Exceptions

ConfigurationException

CacheName is empty or MaxTime is zero.