diff options
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock')
-rw-r--r-- | samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs | 26 | ||||
-rw-r--r-- | samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs | 28 |
2 files changed, 2 insertions, 52 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs index c6f2b89..83196db 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs +++ b/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs @@ -26,7 +26,7 @@ namespace DotNetOpenAuth.ApplicationBlock { /// <summary> /// The Consumer to use for accessing Google data APIs. /// </summary> - private static readonly ServiceProviderDescription GoogleDescription = new ServiceProviderDescription { + public static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription { RequestTokenEndpoint = new MessageReceivingEndpoint("https://www.google.com/accounts/OAuthGetRequestToken", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest), UserAuthorizationEndpoint = new MessageReceivingEndpoint("https://www.google.com/accounts/OAuthAuthorizeToken", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest), AccessTokenEndpoint = new MessageReceivingEndpoint("https://www.google.com/accounts/OAuthGetAccessToken", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest), @@ -69,30 +69,6 @@ namespace DotNetOpenAuth.ApplicationBlock { } /// <summary> - /// Initializes a new instance of the <see cref="WebConsumer"/> class that is prepared to communicate with Google. - /// </summary> - /// <param name="tokenManager">The token manager.</param> - /// <param name="consumerKey">The consumer key.</param> - /// <returns>The newly instantiated <see cref="WebConsumer"/>.</returns> - public static WebConsumer CreateWebConsumer(ITokenManager tokenManager, string consumerKey) { - return new WebConsumer(GoogleDescription, tokenManager) { - ConsumerKey = consumerKey, - }; - } - - /// <summary> - /// Initializes a new instance of the <see cref="DesktopConsumer"/> class that is prepared to communicate with Google. - /// </summary> - /// <param name="tokenManager">The token manager.</param> - /// <param name="consumerKey">The consumer key.</param> - /// <returns>The newly instantiated <see cref="DesktopConsumer"/>.</returns> - public static DesktopConsumer CreateDesktopConsumer(ITokenManager tokenManager, string consumerKey) { - return new DesktopConsumer(GoogleDescription, tokenManager) { - ConsumerKey = consumerKey, - }; - } - - /// <summary> /// Requests authorization from Google to access data from a set of Google applications. /// </summary> /// <param name="consumer">The Google consumer previously constructed using <see cref="CreateWebConsumer"/> or <see cref="CreateDesktopConsumer"/>.</param> diff --git a/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs index cd90365..2a98ffe 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs +++ b/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs @@ -21,7 +21,7 @@ namespace DotNetOpenAuth.ApplicationBlock { /// <summary> /// The description of Twitter's OAuth protocol URIs. /// </summary> - private static readonly ServiceProviderDescription TwitterDescription = new ServiceProviderDescription { + public static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription { RequestTokenEndpoint = new MessageReceivingEndpoint("http://twitter.com/oauth/request_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest), UserAuthorizationEndpoint = new MessageReceivingEndpoint("http://twitter.com/oauth/authorize", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest), AccessTokenEndpoint = new MessageReceivingEndpoint("http://twitter.com/oauth/access_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest), @@ -38,32 +38,6 @@ namespace DotNetOpenAuth.ApplicationBlock { /// </summary> private static readonly MessageReceivingEndpoint GetFriendTimelineStatusEndpoint = new MessageReceivingEndpoint("http://twitter.com/statuses/friends_timeline.xml", HttpDeliveryMethods.GetRequest); - /// <summary> - /// Initializes a new instance of the <see cref="WebConsumer"/> class that is - /// prepared to communicate with Twitter. - /// </summary> - /// <param name="tokenManager">The token manager.</param> - /// <param name="consumerKey">The consumer key.</param> - /// <returns>The newly instantiated <see cref="WebConsumer"/>.</returns> - public static WebConsumer CreateWebConsumer(ITokenManager tokenManager, string consumerKey) { - return new WebConsumer(TwitterDescription, tokenManager) { - ConsumerKey = consumerKey, - }; - } - - /// <summary> - /// Initializes a new instance of the <see cref="DesktopConsumer"/> class that is - /// prepared to communicate with Twitter. - /// </summary> - /// <param name="tokenManager">The token manager.</param> - /// <param name="consumerKey">The consumer key.</param> - /// <returns>The newly instantiated <see cref="DesktopConsumer"/>.</returns> - public static DesktopConsumer CreateDesktopConsumer(ITokenManager tokenManager, string consumerKey) { - return new DesktopConsumer(TwitterDescription, tokenManager) { - ConsumerKey = consumerKey, - }; - } - public static XDocument GetUpdates(ConsumerBase twitter, string accessToken) { IncomingWebResponse response = twitter.PrepareAuthorizedRequestAndSend(GetFriendTimelineStatusEndpoint, accessToken); return XDocument.Load(XmlReader.Create(response.GetResponseReader())); |