summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.ApplicationBlock
diff options
context:
space:
mode:
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj2
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/FacebookClient.cs24
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/TokenManager.cs18
3 files changed, 44 insertions, 0 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
index 6739bf9..b8a7623 100644
--- a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
+++ b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
@@ -86,11 +86,13 @@
<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="InMemoryTokenManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TokenManager.cs" />
<Compile Include="TwitterConsumer.cs" />
<Compile Include="Util.cs" />
<Compile Include="YubikeyRelyingParty.cs" />
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,
+ };
+ }
+ }
+}