diff options
author | David Christiansen <coding@davedoes.net> | 2012-03-15 22:10:55 +0000 |
---|---|---|
committer | David Christiansen <coding@davedoes.net> | 2012-03-15 22:10:55 +0000 |
commit | a5bfa2bb8a614b1932ec8b7bbc6a0cc6bca3051f (patch) | |
tree | a3057157fa3287e0c0c4cc49be1854f9aa63d321 /src/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestAtRelyingPartyFactory.cs | |
parent | 02ce959db12fec57e846e5ebfa662cd0327ce69c (diff) | |
download | DotNetOpenAuth.Samples-a5bfa2bb8a614b1932ec8b7bbc6a0cc6bca3051f.zip DotNetOpenAuth.Samples-a5bfa2bb8a614b1932ec8b7bbc6a0cc6bca3051f.tar.gz DotNetOpenAuth.Samples-a5bfa2bb8a614b1932ec8b7bbc6a0cc6bca3051f.tar.bz2 |
W.I.P.
* Initial migration and reference to DNOA Nuget packages (From teamcity.dotnetopenauth.net)
* Awaiting fix to DotNetOpenAuth.OpenIdOAuth.nuspec in order to complete migration.
Diffstat (limited to 'src/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestAtRelyingPartyFactory.cs')
-rw-r--r-- | src/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestAtRelyingPartyFactory.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestAtRelyingPartyFactory.cs b/src/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestAtRelyingPartyFactory.cs new file mode 100644 index 0000000..afa242e --- /dev/null +++ b/src/DotNetOpenAuth.ApplicationBlock/CustomExtensions/UIRequestAtRelyingPartyFactory.cs @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------- +// <copyright file="UIRequestAtRelyingPartyFactory.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. 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> + /// <param name="typeUri">The type URI of the extension.</param> + /// <param name="data">The parameters associated specifically with this extension.</param> + /// <param name="baseMessage">The OpenID message carrying this extension.</param> + /// <param name="isProviderRole">A value indicating whether this extension is being received at the OpenID Provider.</param> + /// <returns> + /// An instance of <see cref="IOpenIdMessageExtension"/> if the factory recognizes + /// the extension described in the input parameters; <c>null</c> otherwise. + /// </returns> + 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; + } + } +} |