Ejemplo n.º 1
0
        public ConsumerFactory(ConsumerOptions consumerOptions,IOAuthProvider provider)
        {
            if (string.IsNullOrEmpty(consumerOptions.ConsumerKey))
                throw new ArgumentNullException("ConsumerKey");

            if (string.IsNullOrEmpty(consumerOptions.ConsumerSecret))
                throw new ArgumentNullException("ConsumerSecret");

            if (string.IsNullOrEmpty(consumerOptions.RequestTokenUrl))
                throw new ArgumentNullException("RequestTokenUrl");

            if (string.IsNullOrEmpty(consumerOptions.AccessTokenUrl))
                throw new ArgumentNullException("AccessTokenUrl");

            if (string.IsNullOrEmpty(consumerOptions.RequestTokenResponseCallbackUrl))
                throw new ArgumentNullException("RequestTokenResponseCallbackUrl");

            this.provider = provider;
            ConsumerOptions = consumerOptions;
        }
Ejemplo n.º 2
0
 public ConsumerFactory(ConsumerOptions consumerOptions)
     : this(consumerOptions,new OAuthProvider())
 {
 }
 public void TestInitialize()
 {
     var options = new ConsumerOptions
     {
         ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"],
         ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"],
         RequestTokenUrl = ConfigurationManager.AppSettings["RequestTokenUrl"],
         AccessTokenUrl = ConfigurationManager.AppSettings["AccessTokenUrl"],
         RequestTokenResponseCallbackUrl = TU.GenerateLocalHostBaseAddress(),
         SignatureMethod = ConfigurationManager.AppSettings["SignatureMethod"] == "hmac_sha1"
         ? SignatureMethod.Hmac_Sha1 : SignatureMethod.PlainText
     };
     var oauth1ConsumerFactory = new ConsumerFactory(options);
     clientConsumer = new OAuth1aClientConsumerAdapter(oauth1ConsumerFactory.CreateConsumer());
 }