Add hashing and other security features #12

Merged
Wesser merged 45 commits from feat/add-security into feat/add-setup 2024-05-29 06:42:47 +03:00
Showing only changes of commit 2efdc6dbfe - Show all commits

View File

@ -26,7 +26,7 @@ public static class DependencyInjection
Secret = configuration["SECURITY_HASH_TOKEN"] Secret = configuration["SECURITY_HASH_TOKEN"]
}); });
var lifeTimeLogin = TimeSpan.FromMinutes(int.Parse(configuration["SECURITY_LIFE_TIME_1_FA"]!)); var lifeTimePreAuthToken = TimeSpan.FromMinutes(int.Parse(configuration["SECURITY_LIFE_TIME_1_FA"]!));
services.AddSingleton(provider => services.AddSingleton(provider =>
{ {
@ -34,7 +34,21 @@ public static class DependencyInjection
return new PreAuthService(cache) return new PreAuthService(cache)
{ {
Lifetime = lifeTimeLogin Lifetime = lifeTimePreAuthToken
};
});
var lifeTimeRefreshToken = TimeSpan.FromMinutes(int.Parse(configuration["SECURITY_LIFE_TIME_RT"]!));
services.AddSingleton(provider =>
{
var cacheService = provider.GetRequiredService<ICacheService>();
var accessTokenService = provider.GetRequiredService<IAccessToken>();
var revokedTokenService = provider.GetRequiredService<IRevokedToken>();
return new AuthService(cacheService, accessTokenService, revokedTokenService)
{
Lifetime = lifeTimeRefreshToken
}; };
}); });