summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestWithHasSession.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-04-05 20:48:53 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-04-05 20:48:53 -0700
commit6f55fac6e0fef226c4ac70e15e6c2884abc95332 (patch)
tree3f6e8d962997f95e3a226289792a15f3fcee32af /samples/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestWithHasSession.cs
parent0d4a42ede11716ddec2d425a72bd25a8e06e7b7e (diff)
downloadDotNetOpenAuth-6f55fac6e0fef226c4ac70e15e6c2884abc95332.zip
DotNetOpenAuth-6f55fac6e0fef226c4ac70e15e6c2884abc95332.tar.gz
DotNetOpenAuth-6f55fac6e0fef226c4ac70e15e6c2884abc95332.tar.bz2
Added DetectGoogleSession sample.
Closes #21
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestWithHasSession.cs')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestWithHasSession.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestWithHasSession.cs b/samples/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestWithHasSession.cs
new file mode 100644
index 0000000..2fa70a3
--- /dev/null
+++ b/samples/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestWithHasSession.cs
@@ -0,0 +1,39 @@
+//-----------------------------------------------------------------------
+// <copyright file="UIRequestAtRelyingPartyFactory.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.ApplicationBlock.CustomExtensions {
+ using System.Collections.Generic;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OpenId.ChannelElements;
+ using DotNetOpenAuth.OpenId.Extensions.UI;
+
+ /// <summary>
+ /// An extension factory that allows the <see cref="UIRequest"/> extension to be received by the relying party.
+ /// </summary>
+ /// <remarks>
+ /// Typically UIRequest is only received by the Provider. But Google mirrors back this data to the relying party
+ /// if our web user is already logged into Google.
+ /// See the OpenIdRelyingPartyWebForms sample's DetectGoogleSession.aspx page for usage of this factory.
+ /// </remarks>
+ public class UIRequestAtRelyingPartyFactory : IOpenIdExtensionFactory {
+ /// <summary>
+ /// The Type URI for the UI extension.
+ /// </summary>
+ private const string UITypeUri = "http://specs.openid.net/extensions/ui/1.0";
+
+ /// <summary>
+ /// Allows UIRequest extensions to be received by the relying party. Useful when Google mirrors back the request
+ /// to indicate that a user is logged in.
+ /// </summary>
+ public DotNetOpenAuth.OpenId.Messages.IOpenIdMessageExtension Create(string typeUri, IDictionary<string, string> data, IProtocolMessageWithExtensions baseMessage, bool isProviderRole) {
+ if (typeUri == UITypeUri && !isProviderRole) {
+ return new UIRequest();
+ }
+
+ return null;
+ }
+ }
+}