Beispiel #1
0
        internal AuthenticationService(Auth0ApiSettings apiSettings, IConfigurationManager <OpenIdConnectConfiguration> configManager, TokenValidationParameters validationParamOverrides, IAsyncPolicy <ClaimsPrincipal> validationRequestPolicy, ISecurityTokenValidator tokenValidator)
        {
            _apiSettings              = apiSettings;
            _configManager            = configManager;
            _validationRequestPolicy  = validationRequestPolicy;
            _validationParamOverrides = validationParamOverrides;
            _tokenValidator           = tokenValidator ?? new JwtSecurityTokenHandler();

            if (_validationRequestPolicy == null)
            {
                _validationRequestPolicy = Policy
                                           .Handle <SecurityTokenSignatureKeyNotFoundException>()
                                           .RetryAsync(1, (ex, retryCount) =>
                {
                    _configManager.RequestRefresh();
                })
                                           .AsAsyncPolicy <ClaimsPrincipal>();
            }
        }
Beispiel #2
0
        public static IConfigurationManager <OpenIdConnectConfiguration> GetConfigurationManager(Auth0ApiSettings apiSettings)
        {
            var documentRetriever = new HttpDocumentRetriever {
                RequireHttps = apiSettings.Issuer.StartsWith("https://")
            };

            return(new ConfigurationManager <OpenIdConnectConfiguration>(
                       $"{apiSettings.Issuer}.well-known/openid-configuration",
                       new OpenIdConnectConfigurationRetriever(),
                       documentRetriever
                       ));
        }
Beispiel #3
0
 public AuthenticationService(Auth0ApiSettings apiSettings, IConfigurationManager <OpenIdConnectConfiguration> configManager, TokenValidationParameters validationParamOverrides) : this(apiSettings, configManager, validationParamOverrides, null, null)
 {
 }
Beispiel #4
0
 public AuthenticationService(Auth0ApiSettings apiSettings, IConfigurationManager <OpenIdConnectConfiguration> configManager) : this(apiSettings, configManager, null, null, null)
 {
 }