Esempio n. 1
0
 private static void ValidateAuthSettings(GitHubAuthSettings settings)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     if (string.IsNullOrWhiteSpace(settings.ClientId))
     {
         throw new ArgumentException(nameof(GitHubAuthSettings.ClientId));
     }
     if (string.IsNullOrWhiteSpace(settings.ClientSecret))
     {
         throw new ArgumentException(nameof(GitHubAuthSettings.ClientSecret));
     }
     if (string.IsNullOrWhiteSpace(settings.BaseUrl))
     {
         throw new ArgumentException(nameof(GitHubAuthSettings.BaseUrl));
     }
     if (string.IsNullOrWhiteSpace(settings.AccessTokenUrl))
     {
         throw new ArgumentException(nameof(GitHubAuthSettings.AccessTokenUrl));
     }
     if (string.IsNullOrWhiteSpace(settings.CallbackUrl))
     {
         throw new ArgumentException(nameof(GitHubAuthSettings.CallbackUrl));
     }
     if (string.IsNullOrWhiteSpace(settings.UserAgent))
     {
         throw new ArgumentException(nameof(GitHubAuthSettings.UserAgent));
     }
 }
Esempio n. 2
0
        public GitHubAuthProvider(IOptions <GitHubAuthSettings> settings, IOptions <JwtIssuerOptions> jwtOptions)
        {
            ValidateAuthSettings(settings.Value);
            ValidateJwtOptions(jwtOptions.Value);

            _settings   = settings.Value;
            _jwtOptions = jwtOptions.Value;
        }