public SiteCookieAuthenticationOptions(
            IOptionsFactory<CookieAuthenticationOptions> factory, 
            IEnumerable<IOptionsChangeTokenSource<CookieAuthenticationOptions>> sources, 
            IOptionsMonitorCache<CookieAuthenticationOptions> cache,
            IOptions<MultiTenantOptions> multiTenantOptionsAccessor,
            IPostConfigureOptions<CookieAuthenticationOptions> cookieOptionsInitializer,
            IHttpContextAccessor httpContextAccessor,
            ILogger<SiteCookieAuthenticationOptions> logger
            )
        {
            _multiTenantOptions = multiTenantOptionsAccessor.Value;
            _cookieOptionsInitializer = cookieOptionsInitializer;
            _httpContextAccessor = httpContextAccessor;
            _log = logger;

            _factory = factory;
            _sources = sources;
            _cache = cache;

            foreach (var source in _sources)
            {
                ChangeToken.OnChange<string>(
                    () => source.GetChangeToken(),
                    (name) => InvokeChanged(name),
                    source.Name);
            }
        }
Esempio n. 2
0
        public SiteGoogleOptions(
            IOptionsFactory <GoogleOptions> factory,
            IEnumerable <IOptionsChangeTokenSource <GoogleOptions> > sources,
            IOptionsMonitorCache <GoogleOptions> cache,
            IOptions <MultiTenantOptions> multiTenantOptionsAccessor,
            IPostConfigureOptions <GoogleOptions> optionsInitializer,
            IDataProtectionProvider dataProtection,
            IHttpContextAccessor httpContextAccessor,
            ILogger <SiteGoogleOptions> logger
            )
        {
            _multiTenantOptions  = multiTenantOptionsAccessor.Value;
            _httpContextAccessor = httpContextAccessor;
            _log = logger;
            _optionsInitializer = optionsInitializer;
            _dp = dataProtection;

            _factory = factory;
            _sources = sources;
            _cache   = cache;

            foreach (var source in _sources)
            {
                ChangeToken.OnChange <string>(
                    () => source.GetChangeToken(),
                    (name) => InvokeChanged(name),
                    source.Name);
            }
        }
 public SiteCookieAuthenticationOptions(
     IPostConfigureOptions <CookieAuthenticationOptions> cookieOptionsInitializer,
     IHttpContextAccessor httpContextAccessor,
     ILogger <SiteCookieAuthenticationOptions> logger
     )
 {
     _cookieOptionsInitializer = cookieOptionsInitializer;
     _httpContextAccessor      = httpContextAccessor;
     _log = logger;
 }
 public SiteCookieAuthenticationOptions(
     IOptionsFactory <CookieAuthenticationOptions> factory,
     IEnumerable <IOptionsChangeTokenSource <CookieAuthenticationOptions> > sources,
     IOptionsMonitorCache <CookieAuthenticationOptions> cache,
     IPostConfigureOptions <CookieAuthenticationOptions> cookieOptionsInitializer,
     IHttpContextAccessor httpContextAccessor,
     ILogger <SiteCookieAuthenticationOptions> logger
     )
 {
     _cookieOptionsInitializer = cookieOptionsInitializer;
     _httpContextAccessor      = httpContextAccessor;
     _log = logger;
 }
Esempio n. 5
0
        public DynamicAuthenticationSchemeProvider(
            IOptions <AuthenticationOptions> options,
            IPostConfigureOptions <OpenIdConnectOptions> oidcPostConfigureOptions,
            IOptionsMonitorCache <OpenIdConnectOptions> oidcOptionsMonitorCache,
            IPostConfigureOptions <Saml2Options> saml2PostConfigureOptions,
            IOptionsMonitorCache <Saml2Options> saml2OptionsMonitorCache,
            ISsoConfigRepository ssoConfigRepository,
            ILogger <DynamicAuthenticationSchemeProvider> logger,
            GlobalSettings globalSettings,
            SamlEnvironment samlEnvironment,
            IHttpContextAccessor httpContextAccessor)
            : base(options)
        {
            _oidcPostConfigureOptions        = oidcPostConfigureOptions;
            _extendedOidcOptionsMonitorCache = oidcOptionsMonitorCache as
                                               IExtendedOptionsMonitorCache <OpenIdConnectOptions>;
            if (_extendedOidcOptionsMonitorCache == null)
            {
                throw new ArgumentNullException("_extendedOidcOptionsMonitorCache could not be resolved.");
            }

            _saml2PostConfigureOptions        = saml2PostConfigureOptions;
            _extendedSaml2OptionsMonitorCache = saml2OptionsMonitorCache as
                                                IExtendedOptionsMonitorCache <Saml2Options>;
            if (_extendedSaml2OptionsMonitorCache == null)
            {
                throw new ArgumentNullException("_extendedSaml2OptionsMonitorCache could not be resolved.");
            }

            _ssoConfigRepository = ssoConfigRepository;
            _logger               = logger;
            _globalSettings       = globalSettings;
            _schemeCacheLifetime  = TimeSpan.FromSeconds(_globalSettings.Sso?.CacheLifetimeInSeconds ?? 30);
            _samlEnvironment      = samlEnvironment;
            _cachedSchemes        = new Dictionary <string, DynamicAuthenticationScheme>();
            _cachedHandlerSchemes = new Dictionary <string, DynamicAuthenticationScheme>();
            _semaphore            = new SemaphoreSlim(1);
            _httpContextAccessor  = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
        }
 public PostConfigureCertificateAuthenticationOptions(IPostConfigureOptions <CertificateValidatorOptions> postConfigureCertificateValidatorOptions)
 {
     this.PostConfigureCertificateValidatorOptions = postConfigureCertificateValidatorOptions ?? throw new ArgumentNullException(nameof(postConfigureCertificateValidatorOptions));
 }
 public static void AddToServiceCollection(this IPostConfigureOptions <StaticFileOptions> options, IServiceCollection services) => services.ConfigureOptions(options);