feat: add auth service to DI
This commit is contained in:
parent
25b6c7d691
commit
2efdc6dbfe
@ -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
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user