Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Commit

Permalink
Giving each extension its own sub-namespace under DNOI.Extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Apr 22, 2008
1 parent 52e6144 commit 587df6d
Show file tree
Hide file tree
Showing 30 changed files with 143 additions and 147 deletions.
7 changes: 3 additions & 4 deletions samples/ProviderPortal/ProfileFields.ascx.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Net.Mail;
using DotNetOpenId.Provider;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.SimpleRegistration;

/// <summary>
/// Handles the collection of the simple registration fields.
Expand Down Expand Up @@ -82,10 +81,10 @@ public DateTime? DateOfBirth {
public Gender? Gender {
get {
if (this.genderDropdownList.SelectedValue == "Male") {
return DotNetOpenId.Extensions.Gender.Male;
return DotNetOpenId.Extensions.SimpleRegistration.Gender.Male;
}
if (this.genderDropdownList.SelectedValue == "Female") {
return DotNetOpenId.Extensions.Gender.Female;
return DotNetOpenId.Extensions.SimpleRegistration.Gender.Female;
}
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions samples/ProviderPortal/decide.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Diagnostics;
using System.Web.Security;
using System.Web.UI;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.SimpleRegistration;
using DotNetOpenId.Provider;

/// <summary>
Expand All @@ -28,7 +28,7 @@ protected void Page_Load(object src, EventArgs e) {
this.profileFields.Visible = true;
this.profileFields.SetRequiredFieldsFromRequest(requestedFields);
if (!IsPostBack) {
this.profileFields.OpenIdProfileFields = new DotNetOpenId.Extensions.SimpleRegistrationFieldValues() {
this.profileFields.OpenIdProfileFields = new SimpleRegistrationFieldValues() {
Email = Membership.GetUser().Email,
};
}
Expand Down
2 changes: 1 addition & 1 deletion samples/RelyingPartyPortal/Code/State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.SimpleRegistration;

/// <summary>
/// Summary description for State
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
using NUnit.Framework;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.AttributeExchange;

namespace DotNetOpenId.Test.Extensions {
[TestFixture]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
using NUnit.Framework;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.AttributeExchange;

namespace DotNetOpenId.Test.Extensions {
[TestFixture]
Expand Down
2 changes: 1 addition & 1 deletion src/DotNetOpenId.Test/Extensions/AttributeExchangeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using NUnit.Framework;
using DotNetOpenId.RelyingParty;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.AttributeExchange;

namespace DotNetOpenId.Test.Extensions {
[TestFixture]
Expand Down
2 changes: 1 addition & 1 deletion src/DotNetOpenId.Test/Extensions/AttributeRequestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
using NUnit.Framework;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.AttributeExchange;

namespace DotNetOpenId.Test.Extensions {
[TestFixture]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
using NUnit.Framework;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.SimpleRegistration;

namespace DotNetOpenId.Test.Extensions {
[TestFixture]
Expand Down
20 changes: 10 additions & 10 deletions src/DotNetOpenId.Test/ExtensionsArgumentsManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
using NUnit.Framework;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.SimpleRegistration;

namespace DotNetOpenId.Test {
[TestFixture]
Expand Down Expand Up @@ -117,15 +117,15 @@ public void TestSregReadingAffinity() {
{"openid.sreg.nickname", "andy"},
};
IIncomingExtensions mgr = ExtensionArgumentsManager.CreateIncomingExtensions(args);
Assert.IsTrue(mgr.ContainsExtension(Constants.sreg.sreg_ns));
Assert.AreEqual("andy", mgr.GetExtensionArguments(Constants.sreg.sreg_ns)["nickname"]);
Assert.IsTrue(mgr.ContainsExtension(Constants.sreg_ns));
Assert.AreEqual("andy", mgr.GetExtensionArguments(Constants.sreg_ns)["nickname"]);
// Now imagine that sreg was used explicitly by something else...
args = new Dictionary<string, string>() {
{"openid.sreg.nickname", "andy"},
{"openid.ns.sreg", "someOtherNS"},
};
mgr = ExtensionArgumentsManager.CreateIncomingExtensions(args);
Assert.IsFalse(mgr.ContainsExtension(Constants.sreg.sreg_ns));
Assert.IsFalse(mgr.ContainsExtension(Constants.sreg_ns));
Assert.AreEqual("andy", mgr.GetExtensionArguments("someOtherNS")["nickname"]);
}

Expand All @@ -135,10 +135,10 @@ public void TestSregWritingAffinity() {
{"nickname", "andy"},
};
var mgr = ExtensionArgumentsManager.CreateOutgoingExtensions(protocol);
mgr.AddExtensionArguments(Constants.sreg.sreg_ns, args);
mgr.AddExtensionArguments(Constants.sreg_ns, args);
var results = mgr.GetArgumentsToSend(true);
Assert.IsTrue(results.ContainsKey("openid.ns.sreg"));
Assert.AreEqual(Constants.sreg.sreg_ns, results["openid.ns.sreg"]);
Assert.AreEqual(Constants.sreg_ns, results["openid.ns.sreg"]);
Assert.IsTrue(results.ContainsKey("openid.sreg.nickname"));
Assert.AreEqual("andy", results["openid.sreg.nickname"]);
}
Expand All @@ -149,10 +149,10 @@ public void TestWritingNoPrefix() {
{"nickname", "andy"},
};
var mgr = ExtensionArgumentsManager.CreateOutgoingExtensions(protocol);
mgr.AddExtensionArguments(Constants.sreg.sreg_ns, args);
mgr.AddExtensionArguments(Constants.sreg_ns, args);
var results = mgr.GetArgumentsToSend(false);
Assert.IsTrue(results.ContainsKey("ns.sreg"));
Assert.AreEqual(Constants.sreg.sreg_ns, results["ns.sreg"]);
Assert.AreEqual(Constants.sreg_ns, results["ns.sreg"]);
Assert.IsTrue(results.ContainsKey("sreg.nickname"));
Assert.AreEqual("andy", results["sreg.nickname"]);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ public void ReadExtensionWithEmptyKey() {
{"openid.sreg", "v1"},
};
var mgr = ExtensionArgumentsManager.CreateIncomingExtensions(args);
var result = mgr.GetExtensionArguments(Constants.sreg.sreg_ns);
var result = mgr.GetExtensionArguments(Constants.sreg_ns);
Assert.AreEqual("v1", result[string.Empty]);
}

Expand All @@ -200,7 +200,7 @@ public void WriteExtensionWithEmptyKey() {
{"", "v1"},
};
var mgr = ExtensionArgumentsManager.CreateOutgoingExtensions(protocol);
mgr.AddExtensionArguments(Constants.sreg.sreg_ns, args);
mgr.AddExtensionArguments(Constants.sreg_ns, args);
var result = mgr.GetArgumentsToSend(true);
Assert.AreEqual(2, result.Count);
Assert.AreEqual("v1", result["openid.sreg"]);
Expand Down
1 change: 1 addition & 0 deletions src/DotNetOpenId.Test/ProfileFieldValuesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Xml.Serialization;
using System.IO;
using NUnit.Framework;
using DotNetOpenId.Extensions.SimpleRegistration;
using DotNetOpenId.Extensions;

namespace DotNetOpenId.Test {
Expand Down
4 changes: 2 additions & 2 deletions src/DotNetOpenId.Test/UriIdentifierTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using NUnit.Framework;
using DotNetOpenId.RelyingParty;
using System.Net;
using DotNetOpenId.Extensions;
using DotNetOpenId.Extensions.SimpleRegistration;

namespace DotNetOpenId.Test {
[TestFixture]
Expand Down Expand Up @@ -74,7 +74,7 @@ void discover(string url, ProtocolVersion version, Identifier expectedLocalId, b
Assert.AreEqual(expectSreg ? 2 : 1, se.ProviderSupportedServiceTypeUris.Length);
Assert.IsTrue(Array.IndexOf(se.ProviderSupportedServiceTypeUris, protocol.ClaimedIdentifierServiceTypeURI)>=0);
if (expectSreg)
Assert.IsTrue(Array.IndexOf(se.ProviderSupportedServiceTypeUris, Constants.sreg.TypeUri) >= 0);
Assert.IsTrue(Array.IndexOf(se.ProviderSupportedServiceTypeUris, Constants.TypeUri) >= 0);
}
void discoverXrds(string page, ProtocolVersion version, Identifier expectedLocalId) {
discover("/xrdsdiscovery/" + page + ".aspx", version, expectedLocalId, true, false);
Expand Down
3 changes: 2 additions & 1 deletion src/DotNetOpenId.TestWeb/ProviderEndpoint.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Specialized;
using DotNetOpenId.Extensions;
using System.Collections.Generic;
using DotNetOpenId.Extensions.AttributeExchange;
using DotNetOpenId.Extensions.SimpleRegistration;

public partial class ProviderEndpoint : System.Web.UI.Page {
const string nicknameTypeUri = AttributeExchangeConstants.Name.Alias;
Expand Down
26 changes: 13 additions & 13 deletions src/DotNetOpenId/DotNetOpenId.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
<Compile Include="Associations.cs" />
<Compile Include="ExtensionArgumentsManager.cs" />
<Compile Include="Extensions\AliasManager.cs" />
<Compile Include="Extensions\AttributeExchangeConstants.cs" />
<Compile Include="Extensions\AttributeExchangeFetchResponse.cs" />
<Compile Include="Extensions\AttributeRequest.cs" />
<Compile Include="Extensions\AttributeValues.cs" />
<Compile Include="Extensions\Constants.cs" />
<Compile Include="Extensions\AttributeExchangeFetchRequest.cs" />
<Compile Include="Extensions\AttributeExchangeStoreRequest.cs" />
<Compile Include="Extensions\AttributeExchangeStoreResponse.cs" />
<Compile Include="Extensions\DemandLevel.cs" />
<Compile Include="Extensions\AttributeExchange\Constants.cs" />
<Compile Include="Extensions\AttributeExchange\AttributeExchangeFetchResponse.cs" />
<Compile Include="Extensions\AttributeExchange\AttributeRequest.cs" />
<Compile Include="Extensions\AttributeExchange\AttributeValues.cs" />
<Compile Include="Extensions\SimpleRegistration\Constants.cs" />
<Compile Include="Extensions\AttributeExchange\AttributeExchangeFetchRequest.cs" />
<Compile Include="Extensions\AttributeExchange\AttributeExchangeStoreRequest.cs" />
<Compile Include="Extensions\AttributeExchange\AttributeExchangeStoreResponse.cs" />
<Compile Include="Extensions\AttributeExchange\DemandLevel.cs" />
<Compile Include="Extensions\IExtension.cs" />
<Compile Include="HmacSha256Association.cs" />
<Compile Include="Identifier.cs" />
Expand Down Expand Up @@ -112,13 +112,13 @@
<Compile Include="Provider\Request.cs" />
<Compile Include="Provider\Response.cs" />
<Compile Include="Provider\ProviderEndpoint.cs" />
<Compile Include="Extensions\Gender.cs" />
<Compile Include="Extensions\SimpleRegistration\Gender.cs" />
<Compile Include="Provider\AssociatedRequest.cs" />
<Compile Include="Extensions\SimpleRegistrationFieldValues.cs" />
<Compile Include="Extensions\SimpleRegistrationRequestFields.cs" />
<Compile Include="Extensions\SimpleRegistration\SimpleRegistrationFieldValues.cs" />
<Compile Include="Extensions\SimpleRegistration\SimpleRegistrationRequestFields.cs" />
<Compile Include="RelyingParty\OpenIdLogin.cs" />
<Compile Include="RelyingParty\OpenIdTextBox.cs" />
<Compile Include="Extensions\SimpleRegistrationRequest.cs" />
<Compile Include="Extensions\SimpleRegistration\SimpleRegistrationRequest.cs" />
<Compile Include="RelyingParty\ServiceEndpoint.cs" />
<Compile Include="CryptUtil.cs" />
<Compile Include="DiffieHellman\DHKeyGeneration.cs" />
Expand Down
2 changes: 1 addition & 1 deletion src/DotNetOpenId/ExtensionArgumentsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ExtensionArgumentsManager : IIncomingExtensions, IOutgoingExtensions {
/// match to namespaces for backward compatibility with other OpenID libraries.
/// </summary>
static readonly Dictionary<string, string> typeUriToAliasAffinity = new Dictionary<string, string> {
{ Extensions.Constants.sreg.sreg_ns, Extensions.Constants.sreg.sreg_compatibility_alias },
{ Extensions.SimpleRegistration.Constants.sreg_ns, Extensions.SimpleRegistration.Constants.sreg_compatibility_alias },
};

private ExtensionArgumentsManager() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Globalization;
using System.Diagnostics;

namespace DotNetOpenId.Extensions {
namespace DotNetOpenId.Extensions.AttributeExchange {
/// <summary>
/// The Attribute Exchange Fetch message, request leg.
/// </summary>
Expand Down Expand Up @@ -42,7 +42,7 @@ bool containsAttribute(string typeUri) {
public Uri UpdateUrl { get; set; }

#region IExtensionRequest Members
string IExtension.TypeUri { get { return Constants.ae.ns; } }
string IExtension.TypeUri { get { return Constants.ns; } }

IDictionary<string, string> IExtensionRequest.Serialize(RelyingParty.IAuthenticationRequest authenticationRequest) {
var fields = new Dictionary<string, string> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Globalization;
using System.Diagnostics;

namespace DotNetOpenId.Extensions {
namespace DotNetOpenId.Extensions.AttributeExchange {
/// <summary>
/// The Attribute Exchange Fetch message, response leg.
/// </summary>
Expand Down Expand Up @@ -44,7 +44,7 @@ bool containsAttribute(string typeUri) {
public Uri UpdateUrl { get; set; }

#region IExtensionResponse Members
string IExtension.TypeUri { get { return Constants.ae.ns; } }
string IExtension.TypeUri { get { return Constants.ns; } }

IDictionary<string, string> IExtensionResponse.Serialize(Provider.IRequest authenticationRequest) {
var fields = new Dictionary<string, string> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using DotNetOpenId.RelyingParty;
using System.Globalization;

namespace DotNetOpenId.Extensions {
namespace DotNetOpenId.Extensions.AttributeExchange {
/// <summary>
/// The Attribute Exchange Store message, request leg.
/// </summary>
Expand Down Expand Up @@ -34,7 +34,7 @@ bool containsAttribute(string typeUri) {
}

#region IExtensionRequest Members
string IExtension.TypeUri { get { return Constants.ae.ns; } }
string IExtension.TypeUri { get { return Constants.ns; } }

IDictionary<string, string> IExtensionRequest.Serialize(RelyingParty.IAuthenticationRequest authenticationRequest) {
var fields = new Dictionary<string, string> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Globalization;
using System.Diagnostics;

namespace DotNetOpenId.Extensions {
namespace DotNetOpenId.Extensions.AttributeExchange {
/// <summary>
/// The Attribute Exchange Store message, response leg.
/// </summary>
Expand All @@ -23,7 +23,7 @@ public class AttributeExchangeStoreResponse : IExtensionResponse {
public string FailureReason { get; set; }

#region IExtensionResponse Members
string IExtension.TypeUri { get { return Constants.ae.ns; } }
string IExtension.TypeUri { get { return Constants.ns; } }

IDictionary<string, string> IExtensionResponse.Serialize(Provider.IRequest authenticationRequest) {
var fields = new Dictionary<string, string> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Text;
using System.Globalization;

namespace DotNetOpenId.Extensions {
namespace DotNetOpenId.Extensions.AttributeExchange {
/// <summary>
/// An individual attribute to be requested of the OpenID Provider using
/// the Attribute Exchange extension.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace DotNetOpenId.Extensions {
namespace DotNetOpenId.Extensions.AttributeExchange {
/// <summary>
/// An individual attribute's value(s) as supplied by an OpenID Provider
/// in response to a prior request by an OpenID Relying Party as part of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
using System.Collections.Generic;
using System.Text;

namespace DotNetOpenId.Extensions {
namespace DotNetOpenId.Extensions.AttributeExchange {
/// <summary>
/// Attribute Exchange constants
/// </summary>
internal static class Constants {
internal const string ns = "http://openid.net/srv/ax/1.0";
}

/// <summary>
/// Attribute types defined at http://www.axschema.org/types/.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace DotNetOpenId.Extensions {
namespace DotNetOpenId.Extensions.AttributeExchange {
/// <summary>
/// Indicates a relying party's level of desire for a particular value
/// to be provided by the OpenID Provider.
Expand Down
Loading

0 comments on commit 587df6d

Please sign in to comment.