public AdminController( IDistributedCache cache, IAuthenticationManager authentication, IRefreshTokenGenerator refreshTokenGenerator, ITokenRefresher tokenRefresherer, IUsersRepository repository, TokenValidationParameters tokenValidationParameters, IOptions <AuthenticationApp.AuthenticationOptions> authenticationOptions, DistributedCacheEntryOptions distributedCacheEntryOptions) { _cache = cache; _authentication = authentication; _refreshTokenGenerator = refreshTokenGenerator; _tokenRefresherer = tokenRefresherer; _repository = repository; _tokenValidationParameters = tokenValidationParameters; _authenticationOptions = authenticationOptions.Value; _distributedCacheEntryOptions = distributedCacheEntryOptions; _authTokenCookieOptions = new CookieOptions() { Domain = "localhost", Path = "/Admin/", Expires = DateTimeOffset.Now.AddMinutes(_authenticationOptions.Lifetime), SameSite = SameSiteMode.Strict, Secure = true, HttpOnly = true }; _refreshTokenCookieOptions = new CookieOptions() { Domain = "localhost", Path = "/Admin/", Expires = DateTimeOffset.Now.AddDays(365), SameSite = SameSiteMode.Strict, Secure = true, HttpOnly = true }; }
public static IServiceCollection AddAuthenticationOptions(this IServiceCollection services, AuthenticationOptions options) => services.AddSingleton(typeof(AuthenticationOptions), options);