/// <summary> /// Метод расширения, который добавляет JWT сервис в IServiceCollection /// </summary> /// <param name="service"></param> /// <param name="configure">Конфигурации для FileStore</param> /// <returns></returns> public static IServiceCollection AddJWTService(this IServiceCollection service, Action <TokenOption> configure) { service.AddScoped <IJWTService, JWTService>(); var tokenOption = new TokenOption(); configure(tokenOption); service.AddSingleton(tokenOption); return(service); }
public JWTService(DatabaseContext context, IPasswordHasher <User> passwordHasher, TokenOption tokenOption) { _context = context; _passwordHasher = passwordHasher; _tokenOption = tokenOption; }