Пример #1
0
 public HackSystemAuthenticationStateHandler(
     ILogger <HackSystemAuthenticationStateHandler> logger,
     IOptionsMonitor <HackSystemAuthenticationOptions> options,
     AuthenticationStateProvider authenticationStateProvider,
     ICookieStorageService cookieStorageService)
 {
     this.logger  = logger;
     this.options = options.CurrentValue;
     this.cookieStorageService        = cookieStorageService;
     this.authenticationStateProvider = authenticationStateProvider as IHackSystemAuthenticationStateProvider;
 }
 public HackSystemAuthenticationStateProvider(
     ILogger <HackSystemAuthenticationStateProvider> logger,
     IOptionsMonitor <HackSystemAuthenticationOptions> options,
     IJWTParserService jwtParser,
     ICookieStorageService cookieStorageService)
 {
     this.logger               = logger;
     this.options              = options.CurrentValue;
     this.jwtParser            = jwtParser;
     this.cookieStorageService = cookieStorageService;
 }
        public HackSystemAuthenticationTokenRefresher(
            ILogger <HackSystemAuthenticationTokenRefresher> logger,
            IServiceScopeFactory serviceScopeFactory,
            IOptionsMonitor <HackSystemAuthenticationOptions> configure)
        {
            this.logger        = logger;
            this.configuration = configure.CurrentValue;

            var scope = serviceScopeFactory.CreateScope();

            this.hackSystemAuthenticationStateHandler = scope.ServiceProvider.GetService <IHackSystemAuthenticationStateHandler>();
            this.httpClient = scope.ServiceProvider.GetService <HttpClient>();

            this.period = this.configuration.TokenRefreshInMinutes * 1000 * 60;
            this.timer  = new Timer(new TimerCallback(this.RefreshTokenCallBack), null, Timeout.Infinite, period);
        }