31 lines
942 B
C#
31 lines
942 B
C#
|
using Microsoft.Extensions.Caching.Memory;
|
||
|
|
||
|
namespace OpenHarbor.JwtTokenManager;
|
||
|
|
||
|
public class JwtTokenManagerBuilderOptions
|
||
|
{
|
||
|
internal Action<JwtTokenManagerCacheOptions>? CacheOptions { get; set; }
|
||
|
public Func<IServiceProvider, IMemoryCache>? CacheFactory { get; set; }
|
||
|
public Action<JwtTokenManagerOptions>? AdditionalConfiguration { get; set; }
|
||
|
|
||
|
public JwtTokenManagerBuilderOptions Cache(Func<IServiceProvider, IMemoryCache>? cacheFactory = null)
|
||
|
{
|
||
|
CacheFactory = cacheFactory;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public JwtTokenManagerBuilderOptions Cache(
|
||
|
Action<JwtTokenManagerCacheOptions> cacheOptions,
|
||
|
Func<IServiceProvider, IMemoryCache>? cacheFactory = null)
|
||
|
{
|
||
|
CacheOptions = cacheOptions;
|
||
|
return Cache(cacheFactory);
|
||
|
}
|
||
|
|
||
|
public JwtTokenManagerBuilderOptions Configuration(
|
||
|
Action<JwtTokenManagerOptions> configureOptions)
|
||
|
{
|
||
|
AdditionalConfiguration = configureOptions;
|
||
|
return this;
|
||
|
}
|
||
|
}
|