Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConsumerBase"/> class.
        /// </summary>
        /// <param name="serviceDescription">The endpoints and behavior of the Service Provider.</param>
        /// <param name="tokenManager">The host's method of storing and recalling tokens and secrets.</param>
        protected ConsumerBase(ServiceProviderDescription serviceDescription, IConsumerTokenManager tokenManager)
        {
            Contract.Requires <ArgumentNullException>(serviceDescription != null);
            Contract.Requires <ArgumentNullException>(tokenManager != null);

            ITamperProtectionChannelBindingElement signingElement = serviceDescription.CreateTamperProtectionElement();
            INonceStore store = new NonceMemoryStore(StandardExpirationBindingElement.MaximumMessageAge);

            this.OAuthChannel     = new OAuthChannel(signingElement, store, tokenManager);
            this.ServiceProvider  = serviceDescription;
            this.SecuritySettings = DotNetOpenAuthSection.Configuration.OAuth.Consumer.SecuritySettings.CreateSecuritySettings();

            Reporting.RecordFeatureAndDependencyUse(this, serviceDescription, tokenManager, null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConsumerBase"/> class.
        /// </summary>
        /// <param name="serviceDescription">The endpoints and behavior of the Service Provider.</param>
        /// <param name="tokenManager">The host's method of storing and recalling tokens and secrets.</param>
        protected ConsumerBase(ServiceProviderDescription serviceDescription, IConsumerTokenManager tokenManager)
        {
            Requires.NotNull(serviceDescription, "serviceDescription");
            Requires.NotNull(tokenManager, "tokenManager");

            ITamperProtectionChannelBindingElement signingElement = serviceDescription.CreateTamperProtectionElement();
            INonceStore store = new NonceMemoryStore(StandardExpirationBindingElement.MaximumMessageAge);

            this.SecuritySettings = OAuthElement.Configuration.Consumer.SecuritySettings.CreateSecuritySettings();
            this.OAuthChannel     = new OAuthConsumerChannel(signingElement, store, tokenManager, this.SecuritySettings);
            this.ServiceProvider  = serviceDescription;

            OAuthReporting.RecordFeatureAndDependencyUse(this, serviceDescription, tokenManager, null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConsumerBase"/> class.
        /// </summary>
        /// <param name="serviceDescription">The endpoints and behavior of the Service Provider.</param>
        /// <param name="tokenManager">The host's method of storing and recalling tokens and secrets.</param>
        protected ConsumerBase(ServiceProviderDescription serviceDescription, ITokenManager tokenManager)
        {
            if (serviceDescription == null)
            {
                throw new ArgumentNullException("serviceDescription");
            }
            if (tokenManager == null)
            {
                throw new ArgumentNullException("tokenManager");
            }

            ITamperProtectionChannelBindingElement signingElement = serviceDescription.CreateTamperProtectionElement();
            INonceStore store = new NonceMemoryStore(StandardExpirationBindingElement.DefaultMaximumMessageAge);

            this.OAuthChannel    = new OAuthChannel(signingElement, store, tokenManager, new OAuthConsumerMessageFactory());
            this.ServiceProvider = serviceDescription;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceProvider"/> class.
        /// </summary>
        /// <param name="serviceDescription">The endpoints and behavior on the Service Provider.</param>
        /// <param name="tokenManager">The host's method of storing and recalling tokens and secrets.</param>
        /// <param name="messageTypeProvider">An object that can figure out what type of message is being received for deserialization.</param>
        public ServiceProvider(ServiceProviderDescription serviceDescription, ITokenManager tokenManager, OAuthServiceProviderMessageFactory messageTypeProvider)
        {
            if (serviceDescription == null)
            {
                throw new ArgumentNullException("serviceDescription");
            }
            if (tokenManager == null)
            {
                throw new ArgumentNullException("tokenManager");
            }
            if (messageTypeProvider == null)
            {
                throw new ArgumentNullException("messageTypeProvider");
            }

            var         signingElement = serviceDescription.CreateTamperProtectionElement();
            INonceStore store          = new NonceMemoryStore(StandardExpirationBindingElement.DefaultMaximumMessageAge);

            this.ServiceDescription = serviceDescription;
            this.OAuthChannel       = new OAuthChannel(signingElement, store, tokenManager, messageTypeProvider);
            this.TokenGenerator     = new StandardTokenGenerator();
        }