예제 #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;
        }
예제 #9
0
 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);
        }