feat: add pre-auth to DI
This commit is contained in:
		| @@ -1,6 +1,8 @@ | |||||||
| using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||||
| using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; | ||||||
|  | using Mirea.Api.Security.Common.Interfaces; | ||||||
| using Mirea.Api.Security.Services; | using Mirea.Api.Security.Services; | ||||||
|  | using System; | ||||||
|  |  | ||||||
| namespace Mirea.Api.Security; | namespace Mirea.Api.Security; | ||||||
|  |  | ||||||
| @@ -24,6 +26,18 @@ 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"]!)); | ||||||
|  |  | ||||||
|  |         services.AddSingleton(provider => | ||||||
|  |         { | ||||||
|  |             var cache = provider.GetRequiredService<ICacheService>(); | ||||||
|  |  | ||||||
|  |             return new PreAuthService(cache) | ||||||
|  |             { | ||||||
|  |                 Lifetime = lifeTimeLogin | ||||||
|  |             }; | ||||||
|  |         }); | ||||||
|  |  | ||||||
|         return services; |         return services; | ||||||
|     } |     } | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user