示例#1
0
 public GoogleAuthenticationProvider(IOAuthConfiguration configuration, IConfigurationProvider configurationProvider)
 {
     _configurationProvider = configurationProvider;
     _clientId     = configuration.ClientId;
     _clientSecret = configuration.ClientSecret;
     _redirectUri  = configuration.RedirectUri;
 }
示例#2
0
        public OAuthOptionsFactory(OAuthAuthorizationProvider provider,
                                   IOAuthConfiguration options,
                                   OAuthJwtFormat format,
                                   IOAuthPathProvider pathProvider)
        {
            if (pathProvider == null)
            {
                throw new ArgumentNullException(nameof(pathProvider));
            }
            if (format == null)
            {
                throw new ArgumentNullException(nameof(format));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            this.provider     = provider;
            this.options      = options;
            this.format       = format;
            this.pathProvider = pathProvider;
        }
示例#3
0
        public static string GetDataUrl(this IOAuthConfiguration configuration, string path)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(configuration.TokenUrl, nameof(configuration.TokenUrl));

            return($"{configuration.DataUrl}{(configuration.DataUrl.EndsWith("/") ? string.Empty : "/")}{path}");
        }
示例#4
0
        public static void ApplyInvariants(this IOAuthConfiguration configuration)
        {
            Guard.AgainstNull(configuration, nameof(configuration));

            Guard.AgainstNullOrEmptyString(configuration.Name, nameof(configuration.Name));
            Guard.AgainstNullOrEmptyString(configuration.ClientId, nameof(configuration.ClientId));
            Guard.AgainstNullOrEmptyString(configuration.ClientSecret, nameof(configuration.ClientSecret));
        }
示例#5
0
        public OAuthJwtFormat(IOAuthConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            this.config = config;
        }
示例#6
0
        public JwtBearerAuthenticationOptionsFactory(IOAuthConfiguration oauthConfig)
        {
            if (oauthConfig == null)
            {
                throw new ArgumentNullException(nameof(oauthConfig));
            }

            this.oauthConfig = oauthConfig;
        }
        public void Add(IOAuthConfiguration configuration)
        {
            Guard.AgainstNull(configuration, nameof(configuration));

            configuration.ApplyInvariants();

            if (_credentials.ContainsKey(configuration.Name))
            {
                throw new ApplicationException(string.Format(Resources.DuplicateNameException, configuration.Name, "OAuth"));
            }

            _credentials.Add(configuration.Name, configuration);
        }
示例#8
0
        public GoogleController(IFormsAuthenticationService formsAuthenticationService, IOAuthConfiguration oAuthConfiguration)
        {
            if (formsAuthenticationService == null)
            {
                throw new ArgumentNullException("formsAuthenticationService");
            }

            if (oAuthConfiguration == null)
            {
                throw new ArgumentNullException("oAuthConfiguration");
            }

            this.formsAuthenticationService = formsAuthenticationService;
            this.oAuthConfiguration = oAuthConfiguration;
        }
 public RestClient()
 {
     _oAuthConfiguration = new OAuthConfiguration();
 }
示例#10
0
 public RestClient(IOAuthConfiguration oAuthConfiguration)
 {
     _oAuthConfiguration = oAuthConfiguration;
 }
示例#11
0
 public TwitterApi(IOAuthConfiguration config)
 {
     ///bad
 }
 public OAuthTwitterWrapper(IOAuthConfiguration authConfig, ITwitterConfiguration twitConfig)
 {
     _authConfig = authConfig;
     _twitConfig = twitConfig;
 }
        public void Setup()
        {
            oAuthConfiguration = MockRepository.GenerateStub<IOAuthConfiguration>();

            restClient = new RestClient(oAuthConfiguration);
        }