Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
 public JWTService(DatabaseContext context, IPasswordHasher <User> passwordHasher, TokenOption tokenOption)
 {
     _context        = context;
     _passwordHasher = passwordHasher;
     _tokenOption    = tokenOption;
 }