示例#1
0
        private async Task <GoogleAuthenticationSettings> GetGoogleAuthenticationSettingsAsync()
        {
            var settings = await _googleAuthenticationService.GetSettingsAsync();

            if (!_googleAuthenticationService.CheckSettings(settings))
            {
                _logger.LogWarning("Google Authentication is not correctly configured.");
                return(null);
            }
            return(settings);
        }
        public async Task ExecuteAsync(RecipeExecutionContext context)
        {
            if (!string.Equals(context.Name, nameof(GoogleAuthenticationSettings), StringComparison.OrdinalIgnoreCase))
            {
                return;
            }
            var model    = context.Step.ToObject <GoogleAuthenticationSettingsViewModel>();
            var settings = await _googleAuthenticationService.GetSettingsAsync();

            settings.ClientID     = model.ClientID;
            settings.ClientSecret = model.ClientSecret;
            settings.CallbackPath = model.CallbackPath;
            await _googleAuthenticationService.UpdateSettingsAsync(settings);
        }