Пример #1
0
        public void Configure(AuthenticationOptions options)
        {
            var settings = GetGoogleAuthenticationSettingsAsync().GetAwaiter().GetResult();

            if (settings == null)
            {
                return;
            }

            if (!_googleAuthenticationService.CheckSettings(settings))
            {
                return;
            }

            options.AddScheme(GoogleDefaults.AuthenticationScheme, builder =>
            {
                builder.DisplayName = "Google";
                builder.HandlerType = typeof(GoogleHandler);
            });
        }
        private async Task <GoogleAuthenticationSettings> GetGoogleAuthenticationSettingsAsync()
        {
            var settings = await _googleAuthenticationService.GetSettingsAsync();

            if (!_googleAuthenticationService.CheckSettings(settings))
            {
                if (_shellSettings.State == TenantState.Running)
                {
                    _logger.LogWarning("Google Authentication is not correctly configured.");
                }

                return(null);
            }

            return(settings);
        }