//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.ApplicationBlock.CustomExtensions { using System.Collections.Generic; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.ChannelElements; using DotNetOpenAuth.OpenId.Extensions.UI; /// /// An extension factory that allows the extension to be received by the relying party. /// /// /// 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. /// public class UIRequestAtRelyingPartyFactory : IOpenIdExtensionFactory { /// /// The Type URI for the UI extension. /// private const string UITypeUri = "http://specs.openid.net/extensions/ui/1.0"; /// /// 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. /// /// The type URI of the extension. /// The parameters associated specifically with this extension. /// The OpenID message carrying this extension. /// A value indicating whether this extension is being received at the OpenID Provider. /// /// An instance of if the factory recognizes /// the extension described in the input parameters; null otherwise. /// public DotNetOpenAuth.OpenId.Messages.IOpenIdMessageExtension Create(string typeUri, IDictionary data, IProtocolMessageWithExtensions baseMessage, bool isProviderRole) { if (typeUri == UITypeUri && !isProviderRole) { return new UIRequest(); } return null; } } }