/// <summary> /// Check that the options are valid. Should throw an exception if things are not ok. /// </summary> public virtual void Validate(OAuthOptions oAuthOptions) { if (string.IsNullOrEmpty(ClientId)) { throw new ArgumentException(nameof(ClientId)); } if (string.IsNullOrEmpty(ClientSecret)) { throw new ArgumentException(nameof(ClientSecret)); } if (string.IsNullOrEmpty(AuthorizationEndpoint)) { throw new ArgumentException(nameof(AuthorizationEndpoint)); } if (string.IsNullOrEmpty(TokenEndpoint)) { throw new ArgumentException(nameof(TokenEndpoint)); } if (string.IsNullOrEmpty(ProviderCallbackUri) && string.IsNullOrEmpty(oAuthOptions.DefaultCallbackUri)) { throw new ArgumentException("If no OAuthOptions.DefaultCallbackUri exists, each agent must supply a CallbackUri in its options.", nameof(ProviderCallbackUri)); } if (string.IsNullOrEmpty(ProviderId)) { throw new ArgumentException(nameof(ProviderId)); } if (string.IsNullOrEmpty(ProviderDisplayName)) { throw new ArgumentException(nameof(ProviderDisplayName)); } }
public OAuthAgentPostConfigureOptions(IDataProtectionProvider dataProtection, IOptionsMonitor <OAuthOptions> optionsMonitor) { _dp = dataProtection; _oAuthOptions = optionsMonitor.CurrentValue; }
public OAuthService(IOptionsMonitor <OAuthOptions> optionsMonitor, IServiceProvider serviceProvider) { Options = optionsMonitor.CurrentValue; _serviceProvider = serviceProvider; }