public ConsumerValidationInspector(IConsumerStore consumerStore) { if (consumerStore == null) { throw new ArgumentNullException("consumerStore"); } _consumerStore = consumerStore; }
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> (); }
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> (); }
/// <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>(); }
/// <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(); }
/// <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); }
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"); }
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"); } }
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); }
/// <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)); }
/// <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)); }
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 (); }
/// <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); }
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(); }
public SignatureValidationInspector(IConsumerStore consumerStore, IOAuthContextSigner signer) { _consumerStore = consumerStore; _signer = signer; }
public SignatureValidationInspector(IConsumerStore consumerStore) : this(consumerStore, new OAuthContextSigner()) { }
public ConsumerValidationInspector(IConsumerStore consumerStore) { if (consumerStore == null) throw new ArgumentNullException("consumerStore"); _consumerStore = consumerStore; }
/// <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; }
/// <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; }