コード例 #1
0
 public ConsumerValidationInspector(IConsumerStore consumerStore)
 {
     if (consumerStore == null)
     {
         throw new ArgumentNullException("consumerStore");
     }
     _consumerStore = consumerStore;
 }
コード例 #2
0
ファイル: OAuthHandlerBase.cs プロジェクト: jonpolak/Rainy
        public OAuthHandlerBase(CredentialsVerifier auth)
        {
            Authenticator = auth;

            ConsumerStore = new RainyConsumerStore ();
            NonceStore = new TestNonceStore ();
            // initialize those classes that are not persisted
            // TODO request tokens should be persisted in the future
            RequestTokens = new SimpleTokenRepository<RequestToken> ();
        }
コード例 #3
0
        public OAuthHandlerBase(CredentialsVerifier auth)
        {
            Authenticator = auth;

            ConsumerStore = new RainyConsumerStore();
            NonceStore    = new TestNonceStore();
            // initialize those classes that are not persisted
            // TODO request tokens should be persisted in the future
            RequestTokens = new SimpleTokenRepository <RequestToken> ();
        }
コード例 #4
0
        /// <summary>
        /// OAuth authorization service provider.
        /// </summary>
        /// <param name="tokenStore">The token store</param>
        /// <param name="consumerStore">The consumer store</param>
        /// <param name="nonceStore">The nonce store.</param>
        public OAuthAuthorizationServer(ITokenStore tokenStore, IConsumerStore consumerStore, INonceStore nonceStore)
        {
            _cryptoKeyStoreTranslate = new CryptoKeyStoreTranslate(tokenStore, consumerStore, nonceStore);
            _tokenStore    = tokenStore;
            _consumerStore = consumerStore;
            _nonceStore    = nonceStore;

            // Create a new instance of the absent parameter list.
            ParametersAbsent = new List <string>();
        }
コード例 #5
0
        /// <summary>
        /// OAuth resource provider.
        /// </summary>
        /// <param name="tokenStore">The token store</param>
        /// <param name="consumerStore">The consumer store</param>
        /// <param name="nonceStore">The nonce store.</param>
        public AuthResource(ITokenStore tokenStore, IConsumerStore consumerStore, INonceStore nonceStore)
        {
            _tokenStore    = tokenStore;
            _consumerStore = consumerStore;
            _nonceStore    = nonceStore;

            ValidateEx();

            // Create the resource provider.
            _resourceServer = new ResourceServer();
        }
コード例 #6
0
ファイル: Provider.cs プロジェクト: waffle-iron/nequeo
        /// <summary>
        /// OAuth provider.
        /// </summary>
        /// <param name="tokenStore">The token store</param>
        /// <param name="consumerStore">The consumer store</param>
        /// <param name="nonceStore">The nonce store.</param>
        /// <param name="inspectors">The collection of validation inspectors.</param>
        public AuthProvider(ITokenStore tokenStore, IConsumerStore consumerStore, INonceStore nonceStore, params IContextInspector[] inspectors)
        {
            _tokenStore    = tokenStore;
            _consumerStore = consumerStore;
            _nonceStore    = nonceStore;

            ValidateEx();

            // Create a new OAuth provider.
            _oAuthProvider = new OAuthProvider(tokenStore, inspectors);
        }
コード例 #7
0
        protected virtual void Configure(ConfigSource config)
        {
            tokenStore             = (ITokenStore)ConfigureComponent(config.GetChild("tokenStore"), typeof(ITokenStore), typeof(HeapTokenStore));
            callbackStore          = (ICallbackStore)ConfigureComponent(config.GetChild("callbackStore"), typeof(ICallbackStore), typeof(HeapCallbackStore));
            consumerStore          = (IConsumerStore)ConfigureComponent(config.GetChild("consumerStore"), typeof(IConsumerStore), typeof(HeapConsumerStore));
            requestIdValidator     = (IRequestIdValidator)ConfigureComponent(config.GetChild("requestIdValidator"), typeof(IRequestIdValidator), typeof(HeapRequestIdValidator));
            resourceAccessVerifier = (IResourceAccessVerifier)ConfigureComponent(config.GetChild("resourceAccessVerifier"), typeof(IResourceAccessVerifier), null);
            tokenGenerator         = (ITokenGenerator)ConfigureComponent(config.GetChild("tokenGenerator"), typeof(ITokenGenerator), typeof(GuidTokenGenerator));
            verificationProvider   = (IVerificationProvider)ConfigureComponent(config.GetChild("verificationProvider"), typeof(IVerificationProvider), typeof(MD5HashVerificationProvider));

            allowOutOfBandCallback = config.GetBoolean("oobCallback");
        }
コード例 #8
0
        private string GetConsumerSecret(string consumerKey)
        {
            IConsumerStore store = ServiceLocator.Current.GetInstance <IConsumerStore>();

            if (store.Contains(consumerKey))
            {
                return(store.GetByKey(consumerKey).Secret);
            }
            else
            {
                throw new ArgumentException("Consumer could not be found for key " + consumerKey, "consumerKey");
            }
        }
コード例 #9
0
ファイル: OController.cs プロジェクト: cvs1989/hooyeswidget
        public OController()
        {
            oAuthContextBuilder = new OAuthContextBuilder();
             tr = new MVC.Sample.Models.TokenRepository();
             tokenstore = new MVC.Sample.Models.SampleMemoryTokenStore(tr);

             iCStore = new SampleConsumerStore();

             Inspector = new ConsumerValidationInspector(iCStore);

             oAuthProvider = new OAuthProvider(tokenstore, Inspector);
             target = new OAuthController(oAuthContextBuilder, oAuthProvider);
        }
コード例 #10
0
        /// <summary>
        /// OAuth provider.
        /// </summary>
        /// <param name="tokenStore">The token store</param>
        /// <param name="consumerStore">The consumer store</param>
        /// <param name="nonceStore">The nonce store.</param>
        public AuthResource(ITokenStore tokenStore, IConsumerStore consumerStore, INonceStore nonceStore)
        {
            _tokenStore    = tokenStore;
            _consumerStore = consumerStore;
            _nonceStore    = nonceStore;

            ValidateEx();

            // Create a new OAuth provider.
            _oAuthProvider = new OAuthProvider(tokenStore,
                                               new SignatureValidationInspector(consumerStore),
                                               new NonceStoreInspector(nonceStore),
                                               new TimestampRangeInspector(new TimeSpan(1, 0, 0)),
                                               new ConsumerValidationInspector(consumerStore));
        }
コード例 #11
0
ファイル: Provider.cs プロジェクト: waffle-iron/nequeo
        /// <summary>
        /// OAuth provider.
        /// </summary>
        /// <param name="tokenStore">The token store</param>
        /// <param name="consumerStore">The consumer store</param>
        /// <param name="nonceStore">The nonce store.</param>
        public AuthProvider(ITokenStore tokenStore, IConsumerStore consumerStore, INonceStore nonceStore)
        {
            _tokenStore    = tokenStore;
            _consumerStore = consumerStore;
            _nonceStore    = nonceStore;

            ValidateEx();

            // Create a new OAuth provider.
            _oAuthProvider = new OAuthProvider(tokenStore,
                                               new SignatureValidationInspector(consumerStore),
                                               new NonceStoreInspector(nonceStore),
                                               new TimestampRangeInspector(new TimeSpan(1, 0, 0)),
                                               new ConsumerValidationInspector(consumerStore),
                                               new XAuthValidationInspector(ValidateXAuthMode, AuthenticateXAuthUsernameAndPassword));
        }
コード例 #12
0
ファイル: OAuthHandlerBase.cs プロジェクト: Dynalon/Rainy
        public OAuthHandler(IAuthenticator auth,
		                     ITokenRepository<AccessToken> access_token_repo,
		                     ITokenRepository<RequestToken> request_token_repo,
		                     ITokenStore token_store)
        {
            this.Authenticator = auth;
            this.AccessTokens = access_token_repo;
            this.RequestTokens = request_token_repo;
            this.TokenStore = token_store;

            this.ConsumerStore = new RainyConsumerStore ();
            //this.NonceStore = new DummyNonceStore ();
            // initialize those classes that are not persisted
            // TODO request tokens should be persisted in the future
            //RequestTokens = new SimpleTokenRepository<RequestToken> ();

            SetupInspectors ();
        }
コード例 #13
0
        /// <summary>
        /// OAuth provider.
        /// </summary>
        /// <param name="tokenStore">The token store</param>
        /// <param name="consumerStore">The consumer store</param>
        /// <param name="nonceStore">The nonce store.</param>
        public AuthProvider(ITokenStore tokenStore, IConsumerStore consumerStore, INonceStore nonceStore)
        {
            _tokenStore    = tokenStore;
            _consumerStore = consumerStore;
            _nonceStore    = nonceStore;

            ValidateEx();

            // Create a new client authenticator
            List <ClientAuthenticationModule> clientAuth = new List <ClientAuthenticationModule>()
            {
                new ClientAuthentication(tokenStore, consumerStore, nonceStore)
            };

            // Create the OAuth servers.
            _oAuthAuthorizationServer = new OAuthAuthorizationServer(tokenStore, consumerStore, nonceStore);
            _authorizationServer      = new AuthorizationServer(_oAuthAuthorizationServer, clientAuth);
        }
コード例 #14
0
        public OAuthHandler(IAuthenticator auth,
                            ITokenRepository <AccessToken> access_token_repo,
                            ITokenRepository <RequestToken> request_token_repo,
                            ITokenStore token_store)
        {
            this.Authenticator = auth;
            this.AccessTokens  = access_token_repo;
            this.RequestTokens = request_token_repo;
            this.TokenStore    = token_store;

            this.ConsumerStore = new RainyConsumerStore();
            //this.NonceStore = new DummyNonceStore ();
            // initialize those classes that are not persisted
            // TODO request tokens should be persisted in the future
            //RequestTokens = new SimpleTokenRepository<RequestToken> ();


            SetupInspectors();
        }
コード例 #15
0
ファイル: OAuthProvider.cs プロジェクト: deveel/cloudb-oauth
        protected virtual void Configure(ConfigSource config)
        {
            tokenStore = (ITokenStore)ConfigureComponent(config.GetChild("tokenStore"), typeof(ITokenStore), typeof(HeapTokenStore));
            callbackStore = (ICallbackStore)ConfigureComponent(config.GetChild("callbackStore"), typeof(ICallbackStore), typeof(HeapCallbackStore));
            consumerStore = (IConsumerStore)ConfigureComponent(config.GetChild("consumerStore"), typeof(IConsumerStore), typeof(HeapConsumerStore));
            requestIdValidator = (IRequestIdValidator)ConfigureComponent(config.GetChild("requestIdValidator"), typeof(IRequestIdValidator), typeof(HeapRequestIdValidator));
            resourceAccessVerifier = (IResourceAccessVerifier)ConfigureComponent(config.GetChild("resourceAccessVerifier"), typeof(IResourceAccessVerifier), null);
            tokenGenerator = (ITokenGenerator)ConfigureComponent(config.GetChild("tokenGenerator"), typeof(ITokenGenerator), typeof(GuidTokenGenerator));
            verificationProvider = (IVerificationProvider)ConfigureComponent(config.GetChild("verificationProvider"), typeof(IVerificationProvider), typeof(MD5HashVerificationProvider));

            allowOutOfBandCallback = config.GetBoolean("oobCallback");
        }
コード例 #16
0
 public SignatureValidationInspector(IConsumerStore consumerStore, IOAuthContextSigner signer)
 {
     _consumerStore = consumerStore;
     _signer        = signer;
 }
コード例 #17
0
 public SignatureValidationInspector(IConsumerStore consumerStore)
     : this(consumerStore, new OAuthContextSigner())
 {
 }
コード例 #18
0
 public ConsumerValidationInspector(IConsumerStore consumerStore)
 {
     if (consumerStore == null) throw new ArgumentNullException("consumerStore");
     _consumerStore = consumerStore;
 }
コード例 #19
0
 public SignatureValidationInspector(IConsumerStore consumerStore)
   : this(consumerStore, new OAuthContextSigner())
 {
 }
コード例 #20
0
 /// <summary>
 /// Client authentication handler.
 /// </summary>
 /// <param name="tokenStore">The token store</param>
 /// <param name="consumerStore">The consumer store</param>
 /// <param name="nonceStore">The nonce store.</param>
 public ClientAuthentication(ITokenStore tokenStore, IConsumerStore consumerStore, INonceStore nonceStore)
 {
     _tokenStore    = tokenStore;
     _consumerStore = consumerStore;
     _nonceStore    = nonceStore;
 }
コード例 #21
0
 public SignatureValidationInspector(IConsumerStore consumerStore, IOAuthContextSigner signer)
 {
   _consumerStore = consumerStore;
   _signer = signer;
 }
コード例 #22
0
 /// <summary>
 /// Internal cryto key store; this is not implemeted not necessary.
 /// </summary>
 /// <param name="tokenStore">The token store</param>
 /// <param name="consumerStore">The consumer store</param>
 /// <param name="nonceStore">The nonce store.</param>
 public CryptoKeyStoreTranslate(ITokenStore tokenStore, IConsumerStore consumerStore, INonceStore nonceStore)
 {
     _tokenStore    = tokenStore;
     _consumerStore = consumerStore;
     _nonceStore    = nonceStore;
 }