Exemplo n.º 1
0
        public void Configure(string name, GithubOptions options)
        {
            // Ignore OpenID Connect client handler instances that don't correspond to the instance managed by the OpenID module.
            if (!string.Equals(name, GithubDefaults.AuthenticationScheme, StringComparison.Ordinal))
            {
                return;
            }

            var loginSettings = GetGithubAuthenticationSettingsAsync().GetAwaiter().GetResult();

            options.ClientId = loginSettings?.ClientID ?? string.Empty;

            try
            {
                options.ClientSecret = _dataProtectionProvider.CreateProtector(GithubConstants.Features.GithubAuthentication).Unprotect(loginSettings.ClientSecret);
            }
            catch
            {
                _logger.LogError("The Microsoft Account secret key could not be decrypted. It may have been encrypted using a different key.");
            }

            if (loginSettings.CallbackPath.HasValue)
            {
                options.CallbackPath = loginSettings.CallbackPath;
            }
        }
Exemplo n.º 2
0
 public void Configure(GithubOptions options) => Debug.Fail("This infrastructure method shouldn't be called.");