Table of Contents

Class CacheStoreExtension

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

Extension methods to persist the data protection keys in an Arc4u cache.

public static class CacheStoreExtension
Inheritance
CacheStoreExtension
Inherited Members

Methods

PersistKeysToCache(IDataProtectionBuilder, IConfiguration, string)

Persists the data protection keys in a cache described by a configuration section.

public static IDataProtectionBuilder PersistKeysToCache(this IDataProtectionBuilder builder, IConfiguration configuration, string configSectionName = "DataProtectionStore")

Parameters

builder IDataProtectionBuilder

The data protection builder.

configuration IConfiguration

The configuration.

configSectionName string

The section holding the CacheStoreOption. The default is DataProtectionStore.

Returns

IDataProtectionBuilder

The data protection builder, to chain calls.

Exceptions

ConfigurationException

The section does not exist or has no CacheKey or CacheName.

PersistKeysToCache(IDataProtectionBuilder, Action<CacheStoreOption>)

Persists the data protection keys in a cache, from code.

public static IDataProtectionBuilder PersistKeysToCache(this IDataProtectionBuilder builder, Action<CacheStoreOption> option)

Parameters

builder IDataProtectionBuilder

The data protection builder.

option Action<CacheStoreOption>

The action that configures the CacheStoreOption.

Returns

IDataProtectionBuilder

The data protection builder, to chain calls.

Examples

builder.Services.AddDataProtection()
    .PersistKeysToCache(o => { o.CacheKey = "DataProtection"; o.CacheName = "Default"; });

Exceptions

ArgumentNullException

CacheKey is null.