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
servicesIServiceCollectionThe service collection.
configurationIConfigurationThe configuration.
sectionNamestringThe section to bind. The default is
Authentication:TokenCache.MaxTimekeeps its default (50 minutes) when it is not in the section.
Examples
services.AddTokenCache(configuration);
Exceptions
AddTokenCache(IServiceCollection, Action<TokenCacheOptions>)
Registers the token cache options from code.
public static void AddTokenCache(this IServiceCollection services, Action<TokenCacheOptions> options)
Parameters
servicesIServiceCollectionThe service collection.
optionsAction<TokenCacheOptions>The action that configures the options.
Examples
services.AddTokenCache(o =>
{
o.CacheName = "Token";
o.MaxTime = TimeSpan.FromMinutes(30);
});