diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-05-06 21:09:19 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-05-06 21:09:19 -0700 |
commit | 91f6fca9adfd016f913cab905a986d68117f6caa (patch) | |
tree | 2e2bb8bf4c0819529ca70c8f5fbfccaf5ad88d20 /samples/DotNetOpenAuth.ApplicationBlock | |
parent | 230e0ee9ad8826e48de7250772eaa895da37afd1 (diff) | |
download | DotNetOpenAuth-91f6fca9adfd016f913cab905a986d68117f6caa.zip DotNetOpenAuth-91f6fca9adfd016f913cab905a986d68117f6caa.tar.gz DotNetOpenAuth-91f6fca9adfd016f913cab905a986d68117f6caa.tar.bz2 |
Working to catch up with latest OAuth 2.0 spec.
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock')
3 files changed, 45 insertions, 0 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj index 28c4ff4..c808070 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj +++ b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj @@ -68,6 +68,7 @@ <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> + <Reference Include="System.Web" /> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> @@ -81,8 +82,10 @@ <Compile Include="CustomExtensions\Acme.cs" /> <Compile Include="CustomExtensions\AcmeRequest.cs" /> <Compile Include="CustomExtensions\AcmeResponse.cs" /> + <Compile Include="FacebookClient.cs" /> <Compile Include="GoogleConsumer.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="TokenManager.cs" /> <Compile Include="TwitterConsumer.cs" /> <Compile Include="Util.cs" /> </ItemGroup> diff --git a/samples/DotNetOpenAuth.ApplicationBlock/FacebookClient.cs b/samples/DotNetOpenAuth.ApplicationBlock/FacebookClient.cs new file mode 100644 index 0000000..be4df21 --- /dev/null +++ b/samples/DotNetOpenAuth.ApplicationBlock/FacebookClient.cs @@ -0,0 +1,24 @@ +using System.Web; +using DotNetOpenAuth.OAuthWrap; + +namespace DotNetOpenAuth.ApplicationBlock { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using DotNetOpenAuth.Messaging; + + public class FacebookClient : WebAppClient { + private static readonly AuthorizationServerDescription FacebookDescription = new AuthorizationServerDescription { + TokenEndpoint = new Uri("https://graph.facebook.com/oauth/access_token"), + AuthorizationEndpoint = new Uri("https://graph.facebook.com/oauth/authorize"), + }; + + /// <summary> + /// Initializes a new instance of the <see cref="FacebookClient"/> class. + /// </summary> + public FacebookClient() : base(FacebookDescription) { + this.TokenManager = new TokenManager(); + } + } +} diff --git a/samples/DotNetOpenAuth.ApplicationBlock/TokenManager.cs b/samples/DotNetOpenAuth.ApplicationBlock/TokenManager.cs new file mode 100644 index 0000000..22099a3 --- /dev/null +++ b/samples/DotNetOpenAuth.ApplicationBlock/TokenManager.cs @@ -0,0 +1,18 @@ +//----------------------------------------------------------------------- +// <copyright file="TokenManager.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.ApplicationBlock { + using System; + using DotNetOpenAuth.OAuthWrap; + + public class TokenManager : IClientTokenManager { + public IAuthorizationState GetAuthorizationState(Uri callbackUrl, string clientState) { + return new AuthorizationState { + Callback = callbackUrl, + }; + } + } +} |