diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2013-02-26 22:55:18 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2013-02-26 22:55:18 -0800 |
commit | 6204dcf07f31b78478bc1ddb55a6ca9027617b67 (patch) | |
tree | 2b92fff13f9e253c9504e73b677ec61b352d9f38 /samples/DotNetOpenAuth.ApplicationBlock/YammerConsumer.cs | |
parent | 38a1162c5cbaea035e655dc9accd92f9de5019ed (diff) | |
download | DotNetOpenAuth-6204dcf07f31b78478bc1ddb55a6ca9027617b67.zip DotNetOpenAuth-6204dcf07f31b78478bc1ddb55a6ca9027617b67.tar.gz DotNetOpenAuth-6204dcf07f31b78478bc1ddb55a6ca9027617b67.tar.bz2 |
Fixes some OAuth 1 build breaks.
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock/YammerConsumer.cs')
-rw-r--r-- | samples/DotNetOpenAuth.ApplicationBlock/YammerConsumer.cs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/YammerConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/YammerConsumer.cs index 4bcb112..1dff5b6 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/YammerConsumer.cs +++ b/samples/DotNetOpenAuth.ApplicationBlock/YammerConsumer.cs @@ -13,12 +13,13 @@ namespace DotNetOpenAuth.ApplicationBlock { using System.Text; using System.Threading; using System.Threading.Tasks; + using System.Web; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OAuth; using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.OAuth.Messages; - public static class YammerConsumer { + public class YammerConsumer : Consumer { /// <summary> /// The Consumer to use for accessing Google data APIs. /// </summary> @@ -28,6 +29,15 @@ namespace DotNetOpenAuth.ApplicationBlock { "https://www.yammer.com/oauth/authorize", "https://www.yammer.com/oauth/access_token"); + public YammerConsumer() { + this.ServiceProvider = ServiceDescription; + this.ConsumerKey = ConfigurationManager.AppSettings["YammerConsumerKey"]; + this.ConsumerSecret = ConfigurationManager.AppSettings["YammerConsumerSecret"]; + this.TemporaryCredentialStorage = HttpContext.Current != null + ? (ITemporaryCredentialStorage)new CookieTemporaryCredentialStorage() + : new MemoryTemporaryCredentialStorage(); + } + /// <summary> /// Gets a value indicating whether the Twitter consumer key and secret are set in the web.config file. /// </summary> @@ -37,16 +47,5 @@ namespace DotNetOpenAuth.ApplicationBlock { !string.IsNullOrEmpty(ConfigurationManager.AppSettings["yammerConsumerSecret"]); } } - - public static Consumer CreateConsumer(bool forWeb = true) { - string consumerKey = ConfigurationManager.AppSettings["yammerConsumerKey"]; - string consumerSecret = ConfigurationManager.AppSettings["yammerConsumerSecret"]; - if (IsConsumerConfigured) { - ITemporaryCredentialStorage storage = forWeb ? (ITemporaryCredentialStorage)new CookieTemporaryCredentialStorage() : new MemoryTemporaryCredentialStorage(); - return new Consumer(consumerKey, consumerSecret, ServiceDescription, storage); - } else { - throw new InvalidOperationException("No Yammer OAuth consumer key and secret could be found in web.config AppSettings."); - } - } } } |