diff options
Diffstat (limited to 'src')
19 files changed, 120 insertions, 98 deletions
diff --git a/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj b/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj index 88ca13a..793ab3e 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj +++ b/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj @@ -20,9 +20,9 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> </PropertyGroup> <ItemGroup> - <Compile Include="OpenId\Behaviors\AXFetchAsSregProviderTransform.cs" /> - <Compile Include="OpenId\Behaviors\GsaIcamProviderProfile.cs" /> - <Compile Include="OpenId\Behaviors\PpidGeneration.cs" /> + <Compile Include="OpenId\Provider\Behaviors\AXFetchAsSregTransform.cs" /> + <Compile Include="OpenId\Provider\Behaviors\GsaIcamProfile.cs" /> + <Compile Include="OpenId\Provider\Behaviors\PpidGeneration.cs" /> <Compile Include="OpenId\ChannelElements\AssociateUnencryptedProviderRequest.cs" /> <Compile Include="OpenId\ChannelElements\OpenIdProviderChannel.cs" /> <Compile Include="OpenId\ChannelElements\OpenIdProviderMessageFactory.cs" /> diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Extensions/ExtensionsInteropProviderHelper.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Extensions/ExtensionsInteropProviderHelper.cs index 0174d3f..558b8fe 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Extensions/ExtensionsInteropProviderHelper.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Extensions/ExtensionsInteropProviderHelper.cs @@ -27,7 +27,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { /// <param name="targetFormat">The target format. Only one flag should be set.</param> /// <returns>The AX attribute type URI in the target format.</returns> internal static string TransformAXFormatTestHook(string axSchemaOrgFormatTypeUri, AXAttributeFormats targetFormat) { - return ExtensionsInteropHelper.TransformAXFormat(axSchemaOrgFormatTypeUri, targetFormat); + return OpenIdExtensionsInteropHelper.TransformAXFormat(axSchemaOrgFormatTypeUri, targetFormat); } /// <summary> @@ -95,7 +95,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { // Remove the sreg response since the RP didn't ask for it. response.Extensions.Remove(sregResponse); - AXAttributeFormats format = ExtensionsInteropHelper.DetectAXFormat(axRequest.Attributes.Select(att => att.TypeUri)); + AXAttributeFormats format = OpenIdExtensionsInteropHelper.DetectAXFormat(axRequest.Attributes.Select(att => att.TypeUri)); if (format == AXAttributeFormats.None) { // No recognized AX attributes were requested. return; @@ -116,7 +116,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { AddAXAttributeValue(axResponse, WellKnownAttributes.Preferences.TimeZone, format, sregResponse.TimeZone); AddAXAttributeValue(axResponse, WellKnownAttributes.Preferences.Language, format, sregResponse.Language); if (sregResponse.Gender.HasValue) { - AddAXAttributeValue(axResponse, WellKnownAttributes.Person.Gender, format, ExtensionsInteropHelper.GenderEncoder.Encode(sregResponse.Gender)); + AddAXAttributeValue(axResponse, WellKnownAttributes.Person.Gender, format, OpenIdExtensionsInteropHelper.GenderEncoder.Encode(sregResponse.Gender)); } } } @@ -131,7 +131,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { /// <param name="value">The value of the attribute.</param> private static void AddAXAttributeValue(FetchResponse ax, string typeUri, AXAttributeFormats format, string value) { if (!string.IsNullOrEmpty(value)) { - string targetTypeUri = ExtensionsInteropHelper.TransformAXFormat(typeUri, format); + string targetTypeUri = OpenIdExtensionsInteropHelper.TransformAXFormat(typeUri, format); if (!ax.Attributes.Contains(targetTypeUri)) { ax.Attributes.Add(targetTypeUri, value); } @@ -148,8 +148,8 @@ namespace DotNetOpenAuth.OpenId.Extensions { Requires.NotNull(ax, "ax"); Requires.NotNullOrEmpty(typeUri, "typeUri"); - foreach (AXAttributeFormats format in ExtensionsInteropHelper.ForEachFormat(AXAttributeFormats.All)) { - string typeUriInFormat = ExtensionsInteropHelper.TransformAXFormat(typeUri, format); + foreach (AXAttributeFormats format in OpenIdExtensionsInteropHelper.ForEachFormat(AXAttributeFormats.All)) { + string typeUriInFormat = OpenIdExtensionsInteropHelper.TransformAXFormat(typeUri, format); if (ax.Attributes.Contains(typeUriInFormat)) { return ax.Attributes[typeUriInFormat].IsRequired ? DemandLevel.Require : DemandLevel.Request; } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Behaviors/AXFetchAsSregProviderTransform.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/AXFetchAsSregTransform.cs index 37adc98..09bde00 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Behaviors/AXFetchAsSregProviderTransform.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/AXFetchAsSregTransform.cs @@ -1,16 +1,17 @@ //----------------------------------------------------------------------- -// <copyright file="AXFetchAsSregProviderTransform.cs" company="Andrew Arnott"> +// <copyright file="AXFetchAsSregTransform.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- -namespace DotNetOpenAuth.OpenId.Behaviors { +namespace DotNetOpenAuth.OpenId.Provider.Behaviors { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Behaviors; using DotNetOpenAuth.OpenId.Extensions; using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; @@ -23,11 +24,11 @@ namespace DotNetOpenAuth.OpenId.Behaviors { /// to the originally requested extension and format. /// </summary> [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sreg", Justification = "Abbreviation")] - public sealed class AXFetchAsSregProviderTransform : AXFetchAsSregTransform, IProviderBehavior { + public sealed class AXFetchAsSregTransform : AXFetchAsSregTransformBase, IProviderBehavior { /// <summary> - /// Initializes a new instance of the <see cref="AXFetchAsSregProviderTransform"/> class. + /// Initializes a new instance of the <see cref="AXFetchAsSregTransform"/> class. /// </summary> - public AXFetchAsSregProviderTransform() { + public AXFetchAsSregTransform() { } #region IProviderBehavior Members diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Behaviors/GsaIcamProviderProfile.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs index 5f4d23c..38f2ae7 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Behaviors/GsaIcamProviderProfile.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs @@ -1,16 +1,17 @@ //----------------------------------------------------------------------- -// <copyright file="GsaIcamProviderProfile.cs" company="Andrew Arnott"> +// <copyright file="GsaIcamProfile.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- -namespace DotNetOpenAuth.OpenId.Behaviors { +namespace DotNetOpenAuth.OpenId.Provider.Behaviors { using System; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using System.Linq; using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Behaviors; using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; @@ -28,16 +29,16 @@ namespace DotNetOpenAuth.OpenId.Behaviors { /// </remarks> [Serializable] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Icam", Justification = "Acronym")] - public sealed class GsaIcamProviderProfile : GsaIcamProfile, IProviderBehavior { + public sealed class GsaIcamProfile : GsaIcamProfileBase, IProviderBehavior { /// <summary> /// The maximum time a shared association can live. /// </summary> private static readonly TimeSpan MaximumAssociationLifetime = TimeSpan.FromSeconds(86400); /// <summary> - /// Initializes a new instance of the <see cref="GsaIcamProviderProfile"/> class. + /// Initializes a new instance of the <see cref="GsaIcamProfile"/> class. /// </summary> - public GsaIcamProviderProfile() { + public GsaIcamProfile() { if (DisableSslRequirement) { Logger.OpenId.Warn("GSA level 1 behavior has its RequireSsl requirement disabled."); } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Behaviors/PpidGeneration.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs index a465611..1a6898e 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Behaviors/PpidGeneration.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs @@ -4,12 +4,13 @@ // </copyright> //----------------------------------------------------------------------- -namespace DotNetOpenAuth.OpenId.Behaviors { +namespace DotNetOpenAuth.OpenId.Provider.Behaviors { using System; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using System.Linq; using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Behaviors; using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy; using DotNetOpenAuth.OpenId.Provider; diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs index ff345d4..c86ee1d 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs @@ -1027,7 +1027,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { startupScript.AppendLine("window.dnoa_internal.popupWindow = function() {"); startupScript.AppendFormat( @"\tvar openidPopup = {0}", - UIUtilities.GetWindowPopupScript(this.RelyingParty, request, "openidPopup")); + OpenId.RelyingParty.Extensions.UI.UIUtilities.GetWindowPopupScript(this.RelyingParty, request, "openidPopup")); startupScript.AppendLine("};"); this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "loginPopup", startupScript.ToString(), true); diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj b/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj index e3ff0ae..cab4f75 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj @@ -20,16 +20,15 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> </PropertyGroup> <ItemGroup> - <Compile Include="OpenId\Behaviors\AXFetchAsSregRelyingPartyTransform.cs" /> - <Compile Include="OpenId\Behaviors\GsaIcamRelyingPartyProfile.cs" /> + <Compile Include="OpenId\RelyingParty\Behaviors\AXFetchAsSregTransform.cs" /> + <Compile Include="OpenId\RelyingParty\Behaviors\GsaIcamProfile.cs" /> <Compile Include="OpenId\ChannelElements\ExtensionsBindingElementRelyingParty.cs" /> <Compile Include="OpenId\ChannelElements\OpenIdRelyingPartyChannel.cs" /> <Compile Include="OpenId\ChannelElements\OpenIdRelyingPartyMessageFactory.cs" /> <Compile Include="OpenId\ChannelElements\RelyingPartySecurityOptions.cs" /> <Compile Include="OpenId\ChannelElements\RelyingPartySigningBindingElement.cs" /> <Compile Include="OpenId\ChannelElements\ReturnToNonceBindingElement.cs" /> - <Compile Include="OpenId\Extensions\ExtensionsInteropRelyingPartyHelper.cs" /> - <Compile Include="OpenId\Extensions\UI\UIUtilities.cs" /> + <Compile Include="OpenId\RelyingParty\Extensions\ExtensionsInteropHelper.cs" /> <Compile Include="OpenId\HostMetaDiscoveryService.cs" /> <Compile Include="OpenId\Interop\AuthenticationResponseShim.cs" /> <Compile Include="OpenId\Interop\ClaimsResponseShim.cs" /> @@ -40,6 +39,7 @@ <Compile Include="OpenId\Messages\IAssociateSuccessfulResponseRelyingParty.cs" /> <Compile Include="OpenId\Messages\AssociateUnencryptedResponseRelyingParty.cs" /> <Compile Include="OpenId\RelyingParty\CryptoKeyStoreAsRelyingPartyAssociationStore.cs" /> + <Compile Include="OpenId\RelyingParty\Extensions\UIUtilities.cs" /> <Compile Include="OpenId\RelyingParty\IRelyingPartyAssociationStore.cs" /> <Compile Include="OpenId\RelyingParty\Associations.cs" /> <Compile Include="OpenId\RelyingParty\AssociationManager.cs" /> diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs index ec97162..873aabe 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs @@ -96,7 +96,7 @@ namespace DotNetOpenAuth.OpenId.Interop { /// </summary> static OpenIdRelyingPartyShim() { relyingParty = new OpenIdRelyingParty(null); - relyingParty.Behaviors.Add(new Behaviors.AXFetchAsSregRelyingPartyTransform()); + relyingParty.Behaviors.Add(new RelyingParty.Behaviors.AXFetchAsSregTransform()); } /// <summary> diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/AXFetchAsSregRelyingPartyTransform.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/AXFetchAsSregTransform.cs index 0fd9b4c..b2794ec 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/AXFetchAsSregRelyingPartyTransform.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/AXFetchAsSregTransform.cs @@ -1,20 +1,22 @@ //----------------------------------------------------------------------- -// <copyright file="AXFetchAsSregRelyingPartyTransform.cs" company="Andrew Arnott"> +// <copyright file="AXFetchAsSregTransform.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- -namespace DotNetOpenAuth.OpenId.Behaviors { +namespace DotNetOpenAuth.OpenId.RelyingParty.Behaviors { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Behaviors; using DotNetOpenAuth.OpenId.Extensions; using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.RelyingParty; + using DotNetOpenAuth.OpenId.RelyingParty.Extensions; /// <summary> /// An Attribute Exchange and Simple Registration filter to make all incoming attribute @@ -22,11 +24,11 @@ namespace DotNetOpenAuth.OpenId.Behaviors { /// to the originally requested extension and format. /// </summary> [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sreg", Justification = "Abbreviation")] - public sealed class AXFetchAsSregRelyingPartyTransform : AXFetchAsSregTransform, IRelyingPartyBehavior { + public sealed class AXFetchAsSregTransform : AXFetchAsSregTransformBase, IRelyingPartyBehavior { /// <summary> - /// Initializes a new instance of the <see cref="AXFetchAsSregRelyingPartyTransform"/> class. + /// Initializes a new instance of the <see cref="AXFetchAsSregTransform"/> class. /// </summary> - public AXFetchAsSregRelyingPartyTransform() { + public AXFetchAsSregTransform() { } #region IRelyingPartyBehavior Members @@ -54,7 +56,7 @@ namespace DotNetOpenAuth.OpenId.Behaviors { void IRelyingPartyBehavior.OnOutgoingAuthenticationRequest(RelyingParty.IAuthenticationRequest request) { // Don't create AX extensions for OpenID 1.x messages, since AX requires OpenID 2.0. if (request.Provider.Version.Major >= 2) { - request.SpreadSregToAX(AXFormats); + request.SpreadSregToAX(this.AXFormats); } } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/GsaIcamRelyingPartyProfile.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/GsaIcamProfile.cs index e8532b2..5a1ddaa 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/GsaIcamRelyingPartyProfile.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/GsaIcamProfile.cs @@ -1,16 +1,17 @@ //----------------------------------------------------------------------- -// <copyright file="GsaIcamRelyingPartyProfile.cs" company="Andrew Arnott"> +// <copyright file="GsaIcamProfile.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- -namespace DotNetOpenAuth.OpenId.Behaviors { +namespace DotNetOpenAuth.OpenId.RelyingParty.Behaviors { using System; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using System.Linq; using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Behaviors; using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; @@ -27,11 +28,11 @@ namespace DotNetOpenAuth.OpenId.Behaviors { /// </remarks> [Serializable] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Icam", Justification = "Acronym")] - public sealed class GsaIcamRelyingPartyProfile : GsaIcamProfile, IRelyingPartyBehavior { + public sealed class GsaIcamProfile : GsaIcamProfileBase, IRelyingPartyBehavior { /// <summary> - /// Initializes a new instance of the <see cref="GsaIcamRelyingPartyProfile"/> class. + /// Initializes a new instance of the <see cref="GsaIcamProfile"/> class. /// </summary> - public GsaIcamRelyingPartyProfile() { + public GsaIcamProfile() { if (DisableSslRequirement) { Logger.OpenId.Warn("GSA level 1 behavior has its RequireSsl requirement disabled."); } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/ExtensionsInteropRelyingPartyHelper.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/ExtensionsInteropHelper.cs index 134aa16..0f7778f 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/ExtensionsInteropRelyingPartyHelper.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/ExtensionsInteropHelper.cs @@ -1,16 +1,17 @@ //----------------------------------------------------------------------- -// <copyright file="ExtensionsInteropRelyingPartyHelper.cs" company="Andrew Arnott"> +// <copyright file="ExtensionsInteropHelper.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- -namespace DotNetOpenAuth.OpenId.Extensions { +namespace DotNetOpenAuth.OpenId.RelyingParty.Extensions { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using System.Linq; using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Extensions; using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.Messages; @@ -19,7 +20,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { /// A set of methods designed to assist in improving interop across different /// OpenID implementations and their extensions. /// </summary> - public static class ExtensionsInteropRelyingPartyHelper { + public static class ExtensionsInteropHelper { /// <summary> /// Adds an Attribute Exchange (AX) extension to the authentication request /// that asks for the same attributes as the Simple Registration (sreg) extension @@ -67,16 +68,16 @@ namespace DotNetOpenAuth.OpenId.Extensions { Logger.OpenId.Debug("Could not determine whether OP supported Sreg or AX. Using both extensions."); } - foreach (AXAttributeFormats format in ExtensionsInteropHelper.ForEachFormat(attributeFormats)) { - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.BirthDate.WholeBirthDate, sreg.BirthDate); - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Contact.HomeAddress.Country, sreg.Country); - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Contact.Email, sreg.Email); - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Name.FullName, sreg.FullName); - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Person.Gender, sreg.Gender); - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Preferences.Language, sreg.Language); - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Name.Alias, sreg.Nickname); - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Contact.HomeAddress.PostalCode, sreg.PostalCode); - ExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Preferences.TimeZone, sreg.TimeZone); + foreach (AXAttributeFormats format in OpenIdExtensionsInteropHelper.ForEachFormat(attributeFormats)) { + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.BirthDate.WholeBirthDate, sreg.BirthDate); + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Contact.HomeAddress.Country, sreg.Country); + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Contact.Email, sreg.Email); + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Name.FullName, sreg.FullName); + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Person.Gender, sreg.Gender); + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Preferences.Language, sreg.Language); + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Name.Alias, sreg.Nickname); + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Contact.HomeAddress.PostalCode, sreg.PostalCode); + OpenIdExtensionsInteropHelper.FetchAttribute(ax, format, WellKnownAttributes.Preferences.TimeZone, sreg.TimeZone); } } @@ -116,7 +117,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { sreg.TimeZone = fetchResponse.GetAttributeValue(WellKnownAttributes.Preferences.TimeZone, formats); string gender = fetchResponse.GetAttributeValue(WellKnownAttributes.Person.Gender, formats); if (gender != null) { - sreg.Gender = (Gender)ExtensionsInteropHelper.GenderEncoder.Decode(gender); + sreg.Gender = (Gender)OpenIdExtensionsInteropHelper.GenderEncoder.Decode(gender); } } @@ -133,7 +134,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { /// The first value of the attribute, if available. /// </returns> internal static string GetAttributeValue(this FetchResponse fetchResponse, string typeUri, AXAttributeFormats formats) { - return ExtensionsInteropHelper.ForEachFormat(formats).Select(format => fetchResponse.GetAttributeValue(ExtensionsInteropHelper.TransformAXFormat(typeUri, format))).FirstOrDefault(s => s != null); + return OpenIdExtensionsInteropHelper.ForEachFormat(formats).Select(format => fetchResponse.GetAttributeValue(OpenIdExtensionsInteropHelper.TransformAXFormat(typeUri, format))).FirstOrDefault(s => s != null); } /// <summary> @@ -144,7 +145,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { /// <returns>The AX format(s) to use based on the Provider's advertised AX support.</returns> private static bool TryDetectOPAttributeFormat(RelyingParty.IAuthenticationRequest request, out AXAttributeFormats attributeFormat) { Requires.NotNull(request, "request"); - attributeFormat = ExtensionsInteropHelper.DetectAXFormat(request.DiscoveryResult.Capabilities); + attributeFormat = OpenIdExtensionsInteropHelper.DetectAXFormat(request.DiscoveryResult.Capabilities); return attributeFormat != AXAttributeFormats.None; } } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/UI/UIUtilities.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/UIUtilities.cs index a24aaba..4606bf7 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/UI/UIUtilities.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/UIUtilities.cs @@ -4,7 +4,7 @@ // </copyright> //----------------------------------------------------------------------- -namespace DotNetOpenAuth.OpenId.Extensions.UI { +namespace DotNetOpenAuth.OpenId.RelyingParty.Extensions.UI { using System; using System.Diagnostics.Contracts; using System.Globalization; @@ -14,17 +14,7 @@ namespace DotNetOpenAuth.OpenId.Extensions.UI { /// <summary> /// Constants used in implementing support for the UI extension. /// </summary> - public static class UIUtilities { - /// <summary> - /// The required width of the popup window the relying party creates for the provider. - /// </summary> - public const int PopupWidth = 500; // UI extension calls for 450px, but Yahoo needs 500px - - /// <summary> - /// The required height of the popup window the relying party creates for the provider. - /// </summary> - public const int PopupHeight = 500; - + internal static class UIUtilities { /// <summary> /// Gets the <c>window.open</c> javascript snippet to use to open a popup window /// compliant with the UI extension. @@ -45,8 +35,8 @@ namespace DotNetOpenAuth.OpenId.Extensions.UI { "(window.showModalDialog ? window.showModalDialog({0}, {1}, 'status:0;resizable:1;scroll:1;center:1;dialogWidth:{2}px; dialogHeight:{3}') : window.open({0}, {1}, 'status=0,toolbar=0,location=1,resizable=1,scrollbars=1,left=' + ((screen.width - {2}) / 2) + ',top=' + ((screen.height - {3}) / 2) + ',width={2},height={3}'));", MessagingUtilities.GetSafeJavascriptValue(popupUrl.AbsoluteUri), MessagingUtilities.GetSafeJavascriptValue(windowName), - PopupWidth, - PopupHeight); + OpenId.Extensions.UI.UIUtilities.PopupWidth, + OpenId.Extensions.UI.UIUtilities.PopupHeight); } } } diff --git a/src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj b/src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj index 6f032c6..9418ccf 100644 --- a/src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj +++ b/src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj @@ -31,13 +31,13 @@ <Compile Include="OpenIdXrdsHelper.cs" /> <Compile Include="OpenId\Association.cs" /> <Compile Include="OpenId\AuthenticationRequestMode.cs" /> - <Compile Include="OpenId\Behaviors\AXFetchAsSregTransform.cs" /> + <Compile Include="OpenId\Behaviors\AXFetchAsSregTransformBase.cs" /> <Compile Include="OpenId\Behaviors\BehaviorStrings.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>BehaviorStrings.resx</DependentUpon> </Compile> - <Compile Include="OpenId\Behaviors\GsaIcamProfile.cs" /> + <Compile Include="OpenId\Behaviors\GsaIcamProfileBase.cs" /> <Compile Include="OpenId\ChannelElements\BackwardCompatibilityBindingElement.cs" /> <Compile Include="OpenId\ChannelElements\SigningBindingElementContract.cs" /> <Compile Include="OpenId\ChannelElements\ExtensionsBindingElement.cs" /> @@ -85,9 +85,10 @@ <Compile Include="OpenId\Extensions\UI\UIConstants.cs" /> <Compile Include="OpenId\Extensions\UI\UIModes.cs" /> <Compile Include="OpenId\Extensions\UI\UIRequest.cs" /> + <Compile Include="OpenId\Extensions\UI\UIUtilities.cs" /> <Compile Include="OpenId\Identifier.cs" /> <Compile Include="OpenId\IdentifierContract.cs" /> - <Compile Include="OpenId\Extensions\ExtensionsInteropHelper.cs" /> + <Compile Include="OpenId\Extensions\OpenIdExtensionsInteropHelper.cs" /> <Compile Include="OpenId\IdentifierDiscoveryResult.cs" /> <Compile Include="OpenId\IIdentifierDiscoveryService.cs" /> <Compile Include="OpenId\IProviderEndpoint.cs" /> @@ -176,7 +177,7 @@ <Project>{60426312-6AE5-4835-8667-37EDEA670222}</Project> <Name>DotNetOpenAuth.Messaging</Name> </ProjectReference> - <ProjectReference Include="..\Org.Mentalis.Security.Cryptography\Org.Mentalis.Security.Cryptography.csproj" Condition=" '$(ExcludeDiffieHellman)' != 'true' " > + <ProjectReference Include="..\Org.Mentalis.Security.Cryptography\Org.Mentalis.Security.Cryptography.csproj" Condition=" '$(ExcludeDiffieHellman)' != 'true' "> <Project>{26DC877F-5987-48DD-9DDB-E62F2DE0E150}</Project> <Name>Org.Mentalis.Security.Cryptography</Name> </ProjectReference> diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/AXFetchAsSregTransform.cs b/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/AXFetchAsSregTransformBase.cs index 8670a0e..41e6b8e 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/AXFetchAsSregTransform.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/AXFetchAsSregTransformBase.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="AXFetchAsSregTransform.cs" company="Andrew Arnott"> +// <copyright file="AXFetchAsSregTransformBase.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -21,23 +21,17 @@ namespace DotNetOpenAuth.OpenId.Behaviors { /// to the originally requested extension and format. /// </summary> [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sreg", Justification = "Abbreviation")] - public abstract class AXFetchAsSregTransform { + public abstract class AXFetchAsSregTransformBase { /// <summary> - /// Initializes static members of the <see cref="AXFetchAsSregTransform"/> class. + /// Initializes a new instance of the <see cref="AXFetchAsSregTransformBase"/> class. /// </summary> - static AXFetchAsSregTransform() { - AXFormats = AXAttributeFormats.Common; - } - - /// <summary> - /// Initializes a new instance of the <see cref="AXFetchAsSregTransform"/> class. - /// </summary> - protected AXFetchAsSregTransform() { + protected AXFetchAsSregTransformBase() { + this.AXFormats = AXAttributeFormats.Common; } /// <summary> /// Gets or sets the AX attribute type URI formats this transform is willing to work with. /// </summary> - public static AXAttributeFormats AXFormats { get; set; } + public AXAttributeFormats AXFormats { get; set; } } } diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfile.cs b/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfileBase.cs index c84e570..25a4e59 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfile.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfileBase.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="GsaIcamProfile.cs" company="Andrew Arnott"> +// <copyright file="GsaIcamProfileBase.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -26,16 +26,16 @@ namespace DotNetOpenAuth.OpenId.Behaviors { /// </remarks> [Serializable] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Icam", Justification = "Acronym")] - public abstract class GsaIcamProfile { + public abstract class GsaIcamProfileBase { /// <summary> /// Backing field for the <see cref="DisableSslRequirement"/> static property. /// </summary> private static bool disableSslRequirement = DotNetOpenAuthSection.Messaging.RelaxSslRequirements; /// <summary> - /// Initializes a new instance of the <see cref="GsaIcamProfile"/> class. + /// Initializes a new instance of the <see cref="GsaIcamProfileBase"/> class. /// </summary> - public GsaIcamProfile() { + public GsaIcamProfileBase() { if (DisableSslRequirement) { Logger.OpenId.Warn("GSA level 1 behavior has its RequireSsl requirement disabled."); } diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ExtensionsInteropHelper.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionsInteropHelper.cs index f0af03d..fb6202e 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ExtensionsInteropHelper.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionsInteropHelper.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="ExtensionsInteropHelper.cs" company="Andrew Arnott"> +// <copyright file="OpenIdExtensionsInteropHelper.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -19,7 +19,7 @@ namespace DotNetOpenAuth.OpenId.Extensions { /// A set of methods designed to assist in improving interop across different /// OpenID implementations and their extensions. /// </summary> - internal static class ExtensionsInteropHelper { + internal static class OpenIdExtensionsInteropHelper { /// <summary> /// The gender decoder to translate AX genders to Sreg. /// </summary> diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIUtilities.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIUtilities.cs new file mode 100644 index 0000000..478666b --- /dev/null +++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIUtilities.cs @@ -0,0 +1,28 @@ +//----------------------------------------------------------------------- +// <copyright file="UIUtilities.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.OpenId.Extensions.UI { + using System; + using System.Diagnostics.Contracts; + using System.Globalization; + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.RelyingParty; + + /// <summary> + /// Constants used in implementing support for the UI extension. + /// </summary> + public static class UIUtilities { + /// <summary> + /// The required width of the popup window the relying party creates for the provider. + /// </summary> + public const int PopupWidth = 500; // UI extension calls for 450px, but Yahoo needs 500px + + /// <summary> + /// The required height of the popup window the relying party creates for the provider. + /// </summary> + public const int PopupHeight = 500; + } +} diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs index 3807113..17caee2 100644 --- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs @@ -12,6 +12,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.RelyingParty; + using DotNetOpenAuth.OpenId.RelyingParty.Extensions; using NUnit.Framework; [TestFixture] @@ -44,7 +45,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { /// </summary> [TestCase] public void SpreadSregToAXNoExtensions() { - ExtensionsInteropRelyingPartyHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg); + ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg); Assert.AreEqual(0, this.authReq.AppliedExtensions.Count()); } @@ -54,7 +55,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { [TestCase] public void SpreadSregToAXBasic() { this.authReq.AddExtension(this.sreg); - ExtensionsInteropRelyingPartyHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg); + ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg); var ax = this.authReq.AppliedExtensions.OfType<FetchRequest>().Single(); Assert.IsFalse(ax.Attributes[WellKnownAttributes.Name.Alias].IsRequired); Assert.IsFalse(ax.Attributes[WellKnownAttributes.Name.FullName].IsRequired); @@ -73,7 +74,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { [TestCase] public void SpreadSregToAxMultipleSchemas() { this.authReq.AddExtension(this.sreg); - ExtensionsInteropRelyingPartyHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg | AXAttributeFormats.SchemaOpenIdNet); + ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg | AXAttributeFormats.SchemaOpenIdNet); var ax = this.authReq.AppliedExtensions.OfType<FetchRequest>().Single(); Assert.IsTrue(ax.Attributes.Contains(WellKnownAttributes.Name.Alias)); Assert.IsTrue(ax.Attributes.Contains(ExtensionsInteropProviderHelper.TransformAXFormatTestHook(WellKnownAttributes.Name.Alias, AXAttributeFormats.SchemaOpenIdNet))); @@ -87,7 +88,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { public void SpreadSregToAxNoOpIfOPSupportsSreg() { this.authReq.AddExtension(this.sreg); this.InjectAdvertisedTypeUri(DotNetOpenAuth.OpenId.Extensions.SimpleRegistration.Constants.sreg_ns); - ExtensionsInteropRelyingPartyHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.All); + ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.All); Assert.IsFalse(this.authReq.AppliedExtensions.OfType<FetchRequest>().Any()); } @@ -98,7 +99,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { public void SpreadSregToAxTargetedAtOPFormat() { this.authReq.AddExtension(this.sreg); this.InjectAdvertisedTypeUri(WellKnownAttributes.Name.FullName); - ExtensionsInteropRelyingPartyHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.OpenIdNetSchema); + ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.OpenIdNetSchema); var ax = this.authReq.AppliedExtensions.OfType<FetchRequest>().Single(); Assert.IsFalse(ax.Attributes.Contains(ExtensionsInteropProviderHelper.TransformAXFormatTestHook(WellKnownAttributes.Contact.Email, AXAttributeFormats.OpenIdNetSchema))); Assert.IsTrue(ax.Attributes.Contains(WellKnownAttributes.Contact.Email)); diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs index c067faf..59850dd 100644 --- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs @@ -13,6 +13,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.Messages; using DotNetOpenAuth.OpenId.RelyingParty; + using DotNetOpenAuth.OpenId.RelyingParty.Extensions; using NUnit.Framework; [TestFixture] @@ -34,7 +35,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { /// </summary> [TestCase] public void UnifyExtensionsAsSregNoExtensions() { - var sreg = ExtensionsInteropRelyingPartyHelper.UnifyExtensionsAsSreg(this.response, true); + var sreg = ExtensionsInteropHelper.UnifyExtensionsAsSreg(this.response, true); Assert.IsNotNull(sreg); Assert.IsNull(sreg.Nickname); } @@ -51,7 +52,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { axInjected.Attributes.Add(WellKnownAttributes.Name.Alias, "nate"); this.extensions.Add(sregInjected); this.extensions.Add(axInjected); - var sreg = ExtensionsInteropRelyingPartyHelper.UnifyExtensionsAsSreg(this.response, true); + var sreg = ExtensionsInteropHelper.UnifyExtensionsAsSreg(this.response, true); Assert.AreSame(sregInjected, sreg); Assert.AreEqual("andy", sreg.Nickname); } @@ -64,7 +65,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { var axInjected = new FetchResponse(); axInjected.Attributes.Add(WellKnownAttributes.Name.Alias, "nate"); this.extensions.Add(axInjected); - var sreg = ExtensionsInteropRelyingPartyHelper.UnifyExtensionsAsSreg(this.response, true); + var sreg = ExtensionsInteropHelper.UnifyExtensionsAsSreg(this.response, true); Assert.AreEqual("nate", sreg.Nickname); } @@ -76,7 +77,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { var axInjected = new FetchResponse(); axInjected.Attributes.Add(ExtensionsInteropProviderHelper.TransformAXFormatTestHook(WellKnownAttributes.Name.Alias, AXAttributeFormats.SchemaOpenIdNet), "nate"); this.extensions.Add(axInjected); - var sreg = ExtensionsInteropRelyingPartyHelper.UnifyExtensionsAsSreg(this.response, true); + var sreg = ExtensionsInteropHelper.UnifyExtensionsAsSreg(this.response, true); Assert.AreEqual("nate", sreg.Nickname); } } |