summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OpenId.RelyingParty
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.OpenId.RelyingParty')
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/ComponentModel/IdentifierConverter.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj9
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/AXFetchAsSregTransform.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs6
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/ExtensionsInteropRelyingPartyHelper.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/IIdentifierDiscoveryService.cs67
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/IdentifierDiscoveryResult.cs497
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanResponse.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseContract.cs11
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseRelyingParty.cs21
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateUnencryptedResponseRelyingParty.cs25
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ProviderEndpointDescription.cs134
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs8
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IProviderEndpoint.cs144
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs4
17 files changed, 63 insertions, 874 deletions
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/ComponentModel/IdentifierConverter.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/ComponentModel/IdentifierConverter.cs
index 523bd02..61c0fd8 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/ComponentModel/IdentifierConverter.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/ComponentModel/IdentifierConverter.cs
@@ -10,6 +10,7 @@ namespace DotNetOpenAuth.ComponentModel {
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.RelyingParty;
/// <summary>
/// A design-time helper to give an OpenID Identifier property an auto-complete functionality
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj b/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj
index 324da14..aa6423f 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj
@@ -14,6 +14,7 @@
<RootNamespace>DotNetOpenAuth</RootNamespace>
<AssemblyName>DotNetOpenAuth.OpenId.RelyingParty</AssemblyName>
</PropertyGroup>
+ <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.Product.props" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -32,8 +33,6 @@
<Compile Include="OpenId\Extensions\ExtensionsInteropRelyingPartyHelper.cs" />
<Compile Include="OpenId\Extensions\UI\UIUtilities.cs" />
<Compile Include="OpenId\HostMetaDiscoveryService.cs" />
- <Compile Include="OpenId\IdentifierDiscoveryResult.cs" />
- <Compile Include="OpenId\IIdentifierDiscoveryService.cs" />
<Compile Include="OpenId\Interop\AuthenticationResponseShim.cs" />
<Compile Include="OpenId\Interop\ClaimsResponseShim.cs" />
<Compile Include="OpenId\Interop\OpenIdRelyingPartyShim.cs" />
@@ -45,7 +44,6 @@
<Compile Include="OpenId\Mvc\OpenIdAjaxOptions.cs" />
<Compile Include="OpenId\Mvc\OpenIdHelper.cs" />
<Compile Include="OpenId\OpenIdXrdsHelper.cs" />
- <Compile Include="OpenId\ProviderEndpointDescription.cs" />
<Compile Include="OpenId\RelyingParty\CryptoKeyStoreAsRelyingPartyAssociationStore.cs" />
<Compile Include="OpenId\RelyingParty\IRelyingPartyAssociationStore.cs" />
<Compile Include="OpenId\RelyingParty\Associations.cs" />
@@ -53,7 +51,6 @@
<Compile Include="OpenId\RelyingParty\AssociationPreference.cs" />
<Compile Include="OpenId\RelyingParty\AuthenticationRequest.cs" />
<Compile Include="OpenId\RelyingParty\DuplicateRequestedHostsComparer.cs" />
- <Compile Include="OpenId\RelyingParty\IProviderEndpoint.cs" />
<Compile Include="OpenId\RelyingParty\IRelyingPartyBehavior.cs" />
<Compile Include="OpenId\RelyingParty\IAuthenticationRequestContract.cs" />
<Compile Include="OpenId\RelyingParty\NegativeAuthenticationResponse.cs" />
@@ -114,6 +111,10 @@
<Project>{3896A32A-E876-4C23-B9B8-78E17D134CD3}</Project>
<Name>DotNetOpenAuth.OpenId</Name>
</ProjectReference>
+ <ProjectReference Include="..\Org.Mentalis.Security.Cryptography\Org.Mentalis.Security.Cryptography.csproj">
+ <Project>{26DC877F-5987-48DD-9DDB-E62F2DE0E150}</Project>
+ <Name>Org.Mentalis.Security.Cryptography</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/AXFetchAsSregTransform.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/AXFetchAsSregTransform.cs
index 70dbe64..9f583b6 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/AXFetchAsSregTransform.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Behaviors/AXFetchAsSregTransform.cs
@@ -14,7 +14,6 @@ namespace DotNetOpenAuth.OpenId.Behaviors {
using DotNetOpenAuth.OpenId.Extensions;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
- using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
/// <summary>
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs
index 585dbcd..d963621 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs
@@ -38,7 +38,7 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
/// <param name="securitySettings">The security settings to apply.</param>
/// <param name="nonVerifying">A value indicating whether the channel is set up with no functional security binding elements.</param>
private OpenIdRelyingPartyChannel(ICryptoKeyStore cryptoKeyStore, INonceStore nonceStore, IMessageFactory messageTypeProvider, RelyingPartySecuritySettings securitySettings, bool nonVerifying) :
- this(messageTypeProvider, InitializeBindingElements(cryptoKeyStore, nonceStore, securitySettings, nonVerifying)) {
+ base(messageTypeProvider, InitializeBindingElements(cryptoKeyStore, nonceStore, securitySettings, nonVerifying)) {
Contract.Requires<ArgumentNullException>(messageTypeProvider != null);
Contract.Requires<ArgumentNullException>(securitySettings != null);
Contract.Requires<ArgumentException>(!nonVerifying || securitySettings is RelyingPartySecuritySettings);
@@ -76,12 +76,12 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
Contract.Requires<ArgumentNullException>(securitySettings != null);
SigningBindingElement signingElement;
- signingElement = nonVerifying ? null : new SigningBindingElement(new CryptoKeyStoreAsRelyingPartyAssociationStore(cryptoKeyStore ?? new MemoryCryptoKeyStore()));
+ signingElement = nonVerifying ? null : new RelyingPartySigningBindingElement(new CryptoKeyStoreAsRelyingPartyAssociationStore(cryptoKeyStore ?? new MemoryCryptoKeyStore()));
var extensionFactory = OpenIdExtensionFactoryAggregator.LoadFromConfiguration();
List<IChannelBindingElement> elements = new List<IChannelBindingElement>(8);
- elements.Add(new ExtensionsBindingElement(extensionFactory, securitySettings));
+ elements.Add(new ExtensionsBindingElementRelyingParty(extensionFactory, securitySettings));
elements.Add(new RelyingPartySecurityOptions(securitySettings));
elements.Add(new BackwardCompatibilityBindingElement());
ReturnToNonceBindingElement requestNonceElement = null;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/ExtensionsInteropRelyingPartyHelper.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/ExtensionsInteropRelyingPartyHelper.cs
index a864da8..b2c9d1e 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/ExtensionsInteropRelyingPartyHelper.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Extensions/ExtensionsInteropRelyingPartyHelper.cs
@@ -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>
- public static class ExtensionsInteropRelyingPartyHelper : ExtensionsInteropHelper {
+ public static class ExtensionsInteropRelyingPartyHelper {
/// <summary>
/// Adds an Attribute Exchange (AX) extension to the authentication request
/// that asks for the same attributes as the Simple Registration (sreg) extension
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/IIdentifierDiscoveryService.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/IIdentifierDiscoveryService.cs
deleted file mode 100644
index fcea327..0000000
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/IIdentifierDiscoveryService.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IIdentifierDiscoveryService.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Text;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId.RelyingParty;
-
- /// <summary>
- /// A module that provides discovery services for OpenID identifiers.
- /// </summary>
- [ContractClass(typeof(IIdentifierDiscoveryServiceContract))]
- public interface IIdentifierDiscoveryService {
- /// <summary>
- /// Performs discovery on the specified identifier.
- /// </summary>
- /// <param name="identifier">The identifier to perform discovery on.</param>
- /// <param name="requestHandler">The means to place outgoing HTTP requests.</param>
- /// <param name="abortDiscoveryChain">if set to <c>true</c>, no further discovery services will be called for this identifier.</param>
- /// <returns>
- /// A sequence of service endpoints yielded by discovery. Must not be null, but may be empty.
- /// </returns>
- [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "2#", Justification = "By design")]
- [Pure]
- IEnumerable<IdentifierDiscoveryResult> Discover(Identifier identifier, IDirectWebRequestHandler requestHandler, out bool abortDiscoveryChain);
- }
-
- /// <summary>
- /// Code contract for the <see cref="IIdentifierDiscoveryService"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IIdentifierDiscoveryService))]
- internal abstract class IIdentifierDiscoveryServiceContract : IIdentifierDiscoveryService {
- /// <summary>
- /// Prevents a default instance of the <see cref="IIdentifierDiscoveryServiceContract"/> class from being created.
- /// </summary>
- private IIdentifierDiscoveryServiceContract() {
- }
-
- #region IDiscoveryService Members
-
- /// <summary>
- /// Performs discovery on the specified identifier.
- /// </summary>
- /// <param name="identifier">The identifier to perform discovery on.</param>
- /// <param name="requestHandler">The means to place outgoing HTTP requests.</param>
- /// <param name="abortDiscoveryChain">if set to <c>true</c>, no further discovery services will be called for this identifier.</param>
- /// <returns>
- /// A sequence of service endpoints yielded by discovery. Must not be null, but may be empty.
- /// </returns>
- IEnumerable<IdentifierDiscoveryResult> IIdentifierDiscoveryService.Discover(Identifier identifier, IDirectWebRequestHandler requestHandler, out bool abortDiscoveryChain) {
- Contract.Requires<ArgumentNullException>(identifier != null);
- Contract.Requires<ArgumentNullException>(requestHandler != null);
- Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
- throw new NotImplementedException();
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/IdentifierDiscoveryResult.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/IdentifierDiscoveryResult.cs
deleted file mode 100644
index c851f24..0000000
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/IdentifierDiscoveryResult.cs
+++ /dev/null
@@ -1,497 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IdentifierDiscoveryResult.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId {
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Text;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId.Messages;
- using DotNetOpenAuth.OpenId.RelyingParty;
-
- /// <summary>
- /// Represents a single OP endpoint from discovery on some OpenID Identifier.
- /// </summary>
- [DebuggerDisplay("ClaimedIdentifier: {ClaimedIdentifier}, ProviderEndpoint: {ProviderEndpoint}, OpenId: {Protocol.Version}")]
- public sealed class IdentifierDiscoveryResult : IProviderEndpoint {
- /// <summary>
- /// Backing field for the <see cref="Protocol"/> property.
- /// </summary>
- private Protocol protocol;
-
- /// <summary>
- /// Backing field for the <see cref="ClaimedIdentifier"/> property.
- /// </summary>
- private Identifier claimedIdentifier;
-
- /// <summary>
- /// Backing field for the <see cref="FriendlyIdentifierForDisplay"/> property.
- /// </summary>
- private string friendlyIdentifierForDisplay;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IdentifierDiscoveryResult"/> class.
- /// </summary>
- /// <param name="providerEndpoint">The provider endpoint.</param>
- /// <param name="claimedIdentifier">The Claimed Identifier.</param>
- /// <param name="userSuppliedIdentifier">The User-supplied Identifier.</param>
- /// <param name="providerLocalIdentifier">The Provider Local Identifier.</param>
- /// <param name="servicePriority">The service priority.</param>
- /// <param name="uriPriority">The URI priority.</param>
- private IdentifierDiscoveryResult(ProviderEndpointDescription providerEndpoint, Identifier claimedIdentifier, Identifier userSuppliedIdentifier, Identifier providerLocalIdentifier, int? servicePriority, int? uriPriority) {
- Contract.Requires<ArgumentNullException>(providerEndpoint != null);
- Contract.Requires<ArgumentNullException>(claimedIdentifier != null);
- this.ProviderEndpoint = providerEndpoint.Uri;
- this.Capabilities = new ReadOnlyCollection<string>(providerEndpoint.Capabilities);
- this.Version = providerEndpoint.Version;
- this.ClaimedIdentifier = claimedIdentifier;
- this.ProviderLocalIdentifier = providerLocalIdentifier ?? claimedIdentifier;
- this.UserSuppliedIdentifier = userSuppliedIdentifier;
- this.ServicePriority = servicePriority;
- this.ProviderEndpointPriority = uriPriority;
- }
-
- /// <summary>
- /// Gets the detected version of OpenID implemented by the Provider.
- /// </summary>
- public Version Version { get; private set; }
-
- /// <summary>
- /// Gets the Identifier that was presented by the end user to the Relying Party,
- /// or selected by the user at the OpenID Provider.
- /// During the initiation phase of the protocol, an end user may enter
- /// either their own Identifier or an OP Identifier. If an OP Identifier
- /// is used, the OP may then assist the end user in selecting an Identifier
- /// to share with the Relying Party.
- /// </summary>
- public Identifier UserSuppliedIdentifier { get; private set; }
-
- /// <summary>
- /// Gets the Identifier that the end user claims to control.
- /// </summary>
- public Identifier ClaimedIdentifier {
- get {
- return this.claimedIdentifier;
- }
-
- internal set {
- // Take care to reparse the incoming identifier to make sure it's
- // not a derived type that will override expected behavior.
- // Elsewhere in this class, we count on the fact that this property
- // is either UriIdentifier or XriIdentifier. MockIdentifier messes it up.
- this.claimedIdentifier = value != null ? Identifier.Reparse(value) : null;
- }
- }
-
- /// <summary>
- /// Gets an alternate Identifier for an end user that is local to a
- /// particular OP and thus not necessarily under the end user's
- /// control.
- /// </summary>
- public Identifier ProviderLocalIdentifier { get; private set; }
-
- /// <summary>
- /// Gets a more user-friendly (but NON-secure!) string to display to the user as his identifier.
- /// </summary>
- /// <returns>A human-readable, abbreviated (but not secure) identifier the user MAY recognize as his own.</returns>
- public string FriendlyIdentifierForDisplay {
- get {
- if (this.friendlyIdentifierForDisplay == null) {
- XriIdentifier xri = this.ClaimedIdentifier as XriIdentifier;
- UriIdentifier uri = this.ClaimedIdentifier as UriIdentifier;
- if (xri != null) {
- if (this.UserSuppliedIdentifier == null || String.Equals(this.UserSuppliedIdentifier, this.ClaimedIdentifier, StringComparison.OrdinalIgnoreCase)) {
- this.friendlyIdentifierForDisplay = this.ClaimedIdentifier;
- } else {
- this.friendlyIdentifierForDisplay = this.UserSuppliedIdentifier;
- }
- } else if (uri != null) {
- if (uri != this.Protocol.ClaimedIdentifierForOPIdentifier) {
- string displayUri = uri.Uri.Host;
-
- // We typically want to display the path, because that will often have the username in it.
- // As Google Apps for Domains and the like become more popular, a standard /openid path
- // will often appear, which is not helpful to identifying the user so we'll avoid including
- // that path if it's present.
- if (!string.Equals(uri.Uri.AbsolutePath, "/openid", StringComparison.OrdinalIgnoreCase)) {
- displayUri += uri.Uri.AbsolutePath.TrimEnd('/');
- }
-
- // Multi-byte unicode characters get encoded by the Uri class for transit.
- // Since this is for display purposes, we want to reverse this and display a readable
- // representation of these foreign characters.
- this.friendlyIdentifierForDisplay = Uri.UnescapeDataString(displayUri);
- }
- } else {
- ErrorUtilities.ThrowInternal("ServiceEndpoint.ClaimedIdentifier neither XRI nor URI.");
- this.friendlyIdentifierForDisplay = this.ClaimedIdentifier;
- }
- }
-
- return this.friendlyIdentifierForDisplay;
- }
- }
-
- /// <summary>
- /// Gets the provider endpoint.
- /// </summary>
- public Uri ProviderEndpoint { get; private set; }
-
- /// <summary>
- /// Gets the @priority given in the XRDS document for this specific OP endpoint.
- /// </summary>
- public int? ProviderEndpointPriority { get; private set; }
-
- /// <summary>
- /// Gets the @priority given in the XRDS document for this service
- /// (which may consist of several endpoints).
- /// </summary>
- public int? ServicePriority { get; private set; }
-
- /// <summary>
- /// Gets the collection of service type URIs found in the XRDS document describing this Provider.
- /// </summary>
- /// <value>Should never be null, but may be empty.</value>
- public ReadOnlyCollection<string> Capabilities { get; private set; }
-
- #region IProviderEndpoint Members
-
- /// <summary>
- /// Gets the URL that the OpenID Provider receives authentication requests at.
- /// </summary>
- /// <value>This value MUST be an absolute HTTP or HTTPS URL.</value>
- Uri IProviderEndpoint.Uri {
- get { return this.ProviderEndpoint; }
- }
-
- #endregion
-
- /// <summary>
- /// Gets an XRDS sorting routine that uses the XRDS Service/@Priority
- /// attribute to determine order.
- /// </summary>
- /// <remarks>
- /// Endpoints lacking any priority value are sorted to the end of the list.
- /// </remarks>
- internal static Comparison<IdentifierDiscoveryResult> EndpointOrder {
- get {
- // Sort first by service type (OpenID 2.0, 1.1, 1.0),
- // then by Service/@priority, then by Service/Uri/@priority
- return (se1, se2) => {
- int result = GetEndpointPrecedenceOrderByServiceType(se1).CompareTo(GetEndpointPrecedenceOrderByServiceType(se2));
- if (result != 0) {
- return result;
- }
- if (se1.ServicePriority.HasValue && se2.ServicePriority.HasValue) {
- result = se1.ServicePriority.Value.CompareTo(se2.ServicePriority.Value);
- if (result != 0) {
- return result;
- }
- if (se1.ProviderEndpointPriority.HasValue && se2.ProviderEndpointPriority.HasValue) {
- return se1.ProviderEndpointPriority.Value.CompareTo(se2.ProviderEndpointPriority.Value);
- } else if (se1.ProviderEndpointPriority.HasValue) {
- return -1;
- } else if (se2.ProviderEndpointPriority.HasValue) {
- return 1;
- } else {
- return 0;
- }
- } else {
- if (se1.ServicePriority.HasValue) {
- return -1;
- } else if (se2.ServicePriority.HasValue) {
- return 1;
- } else {
- // neither service defines a priority, so base ordering by uri priority.
- if (se1.ProviderEndpointPriority.HasValue && se2.ProviderEndpointPriority.HasValue) {
- return se1.ProviderEndpointPriority.Value.CompareTo(se2.ProviderEndpointPriority.Value);
- } else if (se1.ProviderEndpointPriority.HasValue) {
- return -1;
- } else if (se2.ProviderEndpointPriority.HasValue) {
- return 1;
- } else {
- return 0;
- }
- }
- }
- };
- }
- }
-
- /// <summary>
- /// Gets the protocol used by the OpenID Provider.
- /// </summary>
- internal Protocol Protocol {
- get {
- if (this.protocol == null) {
- this.protocol = Protocol.Lookup(this.Version);
- }
-
- return this.protocol;
- }
- }
-
- /// <summary>
- /// Implements the operator ==.
- /// </summary>
- /// <param name="se1">The first service endpoint.</param>
- /// <param name="se2">The second service endpoint.</param>
- /// <returns>The result of the operator.</returns>
- public static bool operator ==(IdentifierDiscoveryResult se1, IdentifierDiscoveryResult se2) {
- return se1.EqualsNullSafe(se2);
- }
-
- /// <summary>
- /// Implements the operator !=.
- /// </summary>
- /// <param name="se1">The first service endpoint.</param>
- /// <param name="se2">The second service endpoint.</param>
- /// <returns>The result of the operator.</returns>
- public static bool operator !=(IdentifierDiscoveryResult se1, IdentifierDiscoveryResult se2) {
- return !(se1 == se2);
- }
-
- /// <summary>
- /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
- /// </summary>
- /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
- /// <returns>
- /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
- /// </returns>
- /// <exception cref="T:System.NullReferenceException">
- /// The <paramref name="obj"/> parameter is null.
- /// </exception>
- public override bool Equals(object obj) {
- var other = obj as IdentifierDiscoveryResult;
- if (other == null) {
- return false;
- }
-
- // We specifically do not check our ProviderSupportedServiceTypeUris array
- // or the priority field
- // as that is not persisted in our tokens, and it is not part of the
- // important assertion validation that is part of the spec.
- return
- this.ClaimedIdentifier == other.ClaimedIdentifier &&
- this.ProviderEndpoint == other.ProviderEndpoint &&
- this.ProviderLocalIdentifier == other.ProviderLocalIdentifier &&
- this.Protocol.EqualsPractically(other.Protocol);
- }
-
- /// <summary>
- /// Serves as a hash function for a particular type.
- /// </summary>
- /// <returns>
- /// A hash code for the current <see cref="T:System.Object"/>.
- /// </returns>
- public override int GetHashCode() {
- return this.ClaimedIdentifier.GetHashCode();
- }
-
- /// <summary>
- /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
- /// </summary>
- /// <returns>
- /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
- /// </returns>
- public override string ToString() {
- StringBuilder builder = new StringBuilder();
- builder.AppendLine("ClaimedIdentifier: " + this.ClaimedIdentifier);
- builder.AppendLine("ProviderLocalIdentifier: " + this.ProviderLocalIdentifier);
- builder.AppendLine("ProviderEndpoint: " + this.ProviderEndpoint);
- builder.AppendLine("OpenID version: " + this.Version);
- builder.AppendLine("Service Type URIs:");
- foreach (string serviceTypeUri in this.Capabilities) {
- builder.Append("\t");
- builder.AppendLine(serviceTypeUri);
- }
- builder.Length -= Environment.NewLine.Length; // trim last newline
- return builder.ToString();
- }
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <typeparam name="T">The extension whose support is being queried.</typeparam>
- /// <returns>
- /// True if support for the extension is advertised. False otherwise.
- /// </returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "No parameter at all.")]
- public bool IsExtensionSupported<T>() where T : IOpenIdMessageExtension, new() {
- T extension = new T();
- return this.IsExtensionSupported(extension);
- }
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <param name="extensionType">The extension whose support is being queried.</param>
- /// <returns>
- /// True if support for the extension is advertised. False otherwise.
- /// </returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- public bool IsExtensionSupported(Type extensionType) {
- var extension = (IOpenIdMessageExtension)Activator.CreateInstance(extensionType);
- return this.IsExtensionSupported(extension);
- }
-
- /// <summary>
- /// Determines whether a given extension is supported by this endpoint.
- /// </summary>
- /// <param name="extension">An instance of the extension to check support for.</param>
- /// <returns>
- /// <c>true</c> if the extension is supported by this endpoint; otherwise, <c>false</c>.
- /// </returns>
- public bool IsExtensionSupported(IOpenIdMessageExtension extension) {
- Contract.Requires<ArgumentNullException>(extension != null);
-
- // Consider the primary case.
- if (this.IsTypeUriPresent(extension.TypeUri)) {
- return true;
- }
-
- // Consider the secondary cases.
- if (extension.AdditionalSupportedTypeUris != null) {
- if (extension.AdditionalSupportedTypeUris.Any(typeUri => this.IsTypeUriPresent(typeUri))) {
- return true;
- }
- }
-
- return false;
- }
-
- /// <summary>
- /// Creates a <see cref="IdentifierDiscoveryResult"/> instance to represent some OP Identifier.
- /// </summary>
- /// <param name="providerIdentifier">The provider identifier (actually the user-supplied identifier).</param>
- /// <param name="providerEndpoint">The provider endpoint.</param>
- /// <param name="servicePriority">The service priority.</param>
- /// <param name="uriPriority">The URI priority.</param>
- /// <returns>The created <see cref="IdentifierDiscoveryResult"/> instance</returns>
- internal static IdentifierDiscoveryResult CreateForProviderIdentifier(Identifier providerIdentifier, ProviderEndpointDescription providerEndpoint, int? servicePriority, int? uriPriority) {
- Contract.Requires<ArgumentNullException>(providerEndpoint != null);
-
- Protocol protocol = Protocol.Lookup(providerEndpoint.Version);
-
- return new IdentifierDiscoveryResult(
- providerEndpoint,
- protocol.ClaimedIdentifierForOPIdentifier,
- providerIdentifier,
- protocol.ClaimedIdentifierForOPIdentifier,
- servicePriority,
- uriPriority);
- }
-
- /// <summary>
- /// Creates a <see cref="IdentifierDiscoveryResult"/> instance to represent some Claimed Identifier.
- /// </summary>
- /// <param name="claimedIdentifier">The claimed identifier.</param>
- /// <param name="providerLocalIdentifier">The provider local identifier.</param>
- /// <param name="providerEndpoint">The provider endpoint.</param>
- /// <param name="servicePriority">The service priority.</param>
- /// <param name="uriPriority">The URI priority.</param>
- /// <returns>The created <see cref="IdentifierDiscoveryResult"/> instance</returns>
- internal static IdentifierDiscoveryResult CreateForClaimedIdentifier(Identifier claimedIdentifier, Identifier providerLocalIdentifier, ProviderEndpointDescription providerEndpoint, int? servicePriority, int? uriPriority) {
- return CreateForClaimedIdentifier(claimedIdentifier, null, providerLocalIdentifier, providerEndpoint, servicePriority, uriPriority);
- }
-
- /// <summary>
- /// Creates a <see cref="IdentifierDiscoveryResult"/> instance to represent some Claimed Identifier.
- /// </summary>
- /// <param name="claimedIdentifier">The claimed identifier.</param>
- /// <param name="userSuppliedIdentifier">The user supplied identifier.</param>
- /// <param name="providerLocalIdentifier">The provider local identifier.</param>
- /// <param name="providerEndpoint">The provider endpoint.</param>
- /// <param name="servicePriority">The service priority.</param>
- /// <param name="uriPriority">The URI priority.</param>
- /// <returns>The created <see cref="IdentifierDiscoveryResult"/> instance</returns>
- internal static IdentifierDiscoveryResult CreateForClaimedIdentifier(Identifier claimedIdentifier, Identifier userSuppliedIdentifier, Identifier providerLocalIdentifier, ProviderEndpointDescription providerEndpoint, int? servicePriority, int? uriPriority) {
- return new IdentifierDiscoveryResult(providerEndpoint, claimedIdentifier, userSuppliedIdentifier, providerLocalIdentifier, servicePriority, uriPriority);
- }
-
- /// <summary>
- /// Determines whether a given type URI is present on the specified provider endpoint.
- /// </summary>
- /// <param name="typeUri">The type URI.</param>
- /// <returns>
- /// <c>true</c> if the type URI is present on the specified provider endpoint; otherwise, <c>false</c>.
- /// </returns>
- internal bool IsTypeUriPresent(string typeUri) {
- Contract.Requires<ArgumentException>(!String.IsNullOrEmpty(typeUri));
- return this.Capabilities.Contains(typeUri);
- }
-
- /// <summary>
- /// Sets the Capabilities property (this method is a test hook.)
- /// </summary>
- /// <param name="value">The value.</param>
- /// <remarks>The publicize.exe tool should work for the unit tests, but for some reason it fails on the build server.</remarks>
- internal void SetCapabilitiesForTestHook(ReadOnlyCollection<string> value) {
- this.Capabilities = value;
- }
-
- /// <summary>
- /// Gets the priority rating for a given type of endpoint, allowing a
- /// priority sorting of endpoints.
- /// </summary>
- /// <param name="endpoint">The endpoint to prioritize.</param>
- /// <returns>An arbitary integer, which may be used for sorting against other returned values from this method.</returns>
- private static double GetEndpointPrecedenceOrderByServiceType(IdentifierDiscoveryResult endpoint) {
- // The numbers returned from this method only need to compare against other numbers
- // from this method, which makes them arbitrary but relational to only others here.
- if (endpoint.Capabilities.Contains(Protocol.V20.OPIdentifierServiceTypeURI)) {
- return 0;
- }
- if (endpoint.Capabilities.Contains(Protocol.V20.ClaimedIdentifierServiceTypeURI)) {
- return 1;
- }
- if (endpoint.Capabilities.Contains(Protocol.V11.ClaimedIdentifierServiceTypeURI)) {
- return 2;
- }
- if (endpoint.Capabilities.Contains(Protocol.V10.ClaimedIdentifierServiceTypeURI)) {
- return 3;
- }
- return 10;
- }
-
-#if CONTRACTS_FULL
- /// <summary>
- /// Verifies conditions that should be true for any valid state of this object.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Called by code contracts.")]
- [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called by code contracts.")]
- [ContractInvariantMethod]
- private void ObjectInvariant() {
- Contract.Invariant(this.ProviderEndpoint != null);
- Contract.Invariant(this.ClaimedIdentifier != null);
- Contract.Invariant(this.ProviderLocalIdentifier != null);
- Contract.Invariant(this.Capabilities != null);
- Contract.Invariant(this.Version != null);
- Contract.Invariant(this.Protocol != null);
- }
-#endif
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/OpenIdRelyingPartyShim.cs
index fc0f32e..ec97162 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.AXFetchAsSregTransform());
+ relyingParty.Behaviors.Add(new Behaviors.AXFetchAsSregRelyingPartyTransform());
}
/// <summary>
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanResponse.cs
index de3dad8..cb44c7c 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanResponse.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanResponse.cs
@@ -10,7 +10,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
- using DotNetOpenAuth.OpenId.Provider;
using Org.Mentalis.Security.Cryptography;
/// <summary>
@@ -37,7 +36,7 @@ namespace DotNetOpenAuth.OpenId.Messages {
/// <remarks>
/// The resulting association is <i>not</i> added to the association store and must be done by the caller.
/// </remarks>
- protected override Association CreateAssociationAtRelyingParty(AssociateRequest request) {
+ protected Association CreateAssociationAtRelyingParty(AssociateRequest request) {
var diffieHellmanRequest = request as AssociateDiffieHellmanRequest;
ErrorUtilities.VerifyArgument(diffieHellmanRequest != null, OpenIdStrings.DiffieHellmanAssociationRequired);
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs
index 19d3a94..7524a18 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs
@@ -6,7 +6,7 @@
using System.Diagnostics.Contracts;
using DotNetOpenAuth.OpenId.RelyingParty;
- internal abstract class AssociateRequestRelyingParty : AssociateRequest {
+ internal static class AssociateRequestRelyingParty {
/// <summary>
/// Creates an association request message that is appropriate for a given Provider.
/// </summary>
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseContract.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseContract.cs
index de28a64..b9fa81b 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseContract.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseContract.cs
@@ -9,7 +9,16 @@
[ContractClassFor(typeof(AssociateSuccessfulResponseRelyingParty))]
internal abstract class AssociateSuccessfulResponseRelyingPartyContract : AssociateSuccessfulResponseRelyingParty {
- protected override Association CreateAssociationAtRelyingParty(AssociateRequest request) {
+ /// <summary>
+ /// Prevents a default instance of the <see cref="AssociateSuccessfulResponseRelyingPartyContract"/> class from being created.
+ /// </summary>
+ /// <param name="version">The version.</param>
+ /// <param name="request">The request.</param>
+ private AssociateSuccessfulResponseRelyingPartyContract(Version version, AssociateRequest request)
+ : base(version, request) {
+ }
+
+ protected internal override Association CreateAssociationAtRelyingParty(AssociateRequest request) {
Contract.Requires<ArgumentNullException>(request != null);
throw new NotImplementedException();
}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseRelyingParty.cs
index 7ee3988..3718a68 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateSuccessfulResponseRelyingParty.cs
@@ -1,15 +1,24 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+namespace DotNetOpenAuth.OpenId.Messages {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
-namespace DotNetOpenAuth.OpenId.Messages {
internal abstract class AssociateSuccessfulResponseRelyingParty : AssociateSuccessfulResponse {
/// <summary>
+ /// Initializes a new instance of the <see cref="AssociateSuccessfulResponseRelyingParty"/> class.
+ /// </summary>
+ /// <param name="version">The version.</param>
+ /// <param name="request">The request.</param>
+ internal AssociateSuccessfulResponseRelyingParty(Version version, AssociateRequest request)
+ : base(version, request) {
+ }
+
+ /// <summary>
/// Called to create the Association based on a request previously given by the Relying Party.
/// </summary>
/// <param name="request">The prior request for an association.</param>
/// <returns>The created association.</returns>
- protected abstract Association CreateAssociationAtRelyingParty(AssociateRequest request);
+ protected internal abstract Association CreateAssociationAtRelyingParty(AssociateRequest request);
}
}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateUnencryptedResponseRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateUnencryptedResponseRelyingParty.cs
index 23cbd9b..dad47be 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateUnencryptedResponseRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateUnencryptedResponseRelyingParty.cs
@@ -1,20 +1,33 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+//-----------------------------------------------------------------------
+// <copyright file="AssociateUnencryptedResponseRelyingParty.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OpenId.Messages {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
internal class AssociateUnencryptedResponseRelyingParty : AssociateUnencryptedResponse {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AssociateUnencryptedResponseRelyingParty"/> class.
+ /// </summary>
+ /// <param name="version">The version.</param>
+ /// <param name="request">The request.</param>
+ internal AssociateUnencryptedResponseRelyingParty(Version version, AssociateUnencryptedRequest request)
+ : base(version, request) {
+ }
/// <summary>
/// Called to create the Association based on a request previously given by the Relying Party.
/// </summary>
/// <param name="request">The prior request for an association.</param>
/// <returns>The created association.</returns>
- protected override Association CreateAssociationAtRelyingParty(AssociateRequest request) {
+ protected Association CreateAssociationAtRelyingParty(AssociateRequest request) {
Association association = HmacShaAssociation.Create(Protocol, this.AssociationType, this.AssociationHandle, this.MacKey, TimeSpan.FromSeconds(this.ExpiresIn));
return association;
}
-
}
}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ProviderEndpointDescription.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ProviderEndpointDescription.cs
deleted file mode 100644
index 6514ffd..0000000
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ProviderEndpointDescription.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="ProviderEndpointDescription.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId {
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId.Messages;
- using DotNetOpenAuth.OpenId.RelyingParty;
-
- /// <summary>
- /// Describes some OpenID Provider endpoint and its capabilities.
- /// </summary>
- /// <remarks>
- /// This is an immutable type.
- /// </remarks>
- [Serializable]
- internal sealed class ProviderEndpointDescription : IProviderEndpoint {
- /// <summary>
- /// Initializes a new instance of the <see cref="ProviderEndpointDescription"/> class.
- /// </summary>
- /// <param name="providerEndpoint">The OpenID Provider endpoint URL.</param>
- /// <param name="openIdVersion">The OpenID version supported by this particular endpoint.</param>
- internal ProviderEndpointDescription(Uri providerEndpoint, Version openIdVersion) {
- Contract.Requires<ArgumentNullException>(providerEndpoint != null);
- Contract.Requires<ArgumentNullException>(openIdVersion != null);
-
- this.Uri = providerEndpoint;
- this.Version = openIdVersion;
- this.Capabilities = new ReadOnlyCollection<string>(EmptyList<string>.Instance);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ProviderEndpointDescription"/> class.
- /// </summary>
- /// <param name="providerEndpoint">The URI the provider listens on for OpenID requests.</param>
- /// <param name="serviceTypeURIs">The set of services offered by this endpoint.</param>
- internal ProviderEndpointDescription(Uri providerEndpoint, IEnumerable<string> serviceTypeURIs) {
- Contract.Requires<ArgumentNullException>(providerEndpoint != null);
- Contract.Requires<ArgumentNullException>(serviceTypeURIs != null);
-
- this.Uri = providerEndpoint;
- this.Capabilities = new ReadOnlyCollection<string>(serviceTypeURIs.ToList());
-
- Protocol opIdentifierProtocol = Protocol.FindBestVersion(p => p.OPIdentifierServiceTypeURI, serviceTypeURIs);
- Protocol claimedIdentifierProviderVersion = Protocol.FindBestVersion(p => p.ClaimedIdentifierServiceTypeURI, serviceTypeURIs);
- if (opIdentifierProtocol != null) {
- this.Version = opIdentifierProtocol.Version;
- } else if (claimedIdentifierProviderVersion != null) {
- this.Version = claimedIdentifierProviderVersion.Version;
- } else {
- ErrorUtilities.ThrowProtocol(OpenIdStrings.ProviderVersionUnrecognized, this.Uri);
- }
- }
-
- /// <summary>
- /// Gets the URL that the OpenID Provider listens for incoming OpenID messages on.
- /// </summary>
- public Uri Uri { get; private set; }
-
- /// <summary>
- /// Gets the OpenID protocol version this endpoint supports.
- /// </summary>
- /// <remarks>
- /// If an endpoint supports multiple versions, each version must be represented
- /// by its own <see cref="ProviderEndpointDescription"/> object.
- /// </remarks>
- public Version Version { get; private set; }
-
- /// <summary>
- /// Gets the collection of service type URIs found in the XRDS document describing this Provider.
- /// </summary>
- internal ReadOnlyCollection<string> Capabilities { get; private set; }
-
- #region IProviderEndpoint Members
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <typeparam name="T">The extension whose support is being queried.</typeparam>
- /// <returns>
- /// True if support for the extension is advertised. False otherwise.
- /// </returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- bool IProviderEndpoint.IsExtensionSupported<T>() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <param name="extensionType">The extension whose support is being queried.</param>
- /// <returns>
- /// True if support for the extension is advertised. False otherwise.
- /// </returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- bool IProviderEndpoint.IsExtensionSupported(Type extensionType) {
- throw new NotImplementedException();
- }
-
- #endregion
-
-#if CONTRACTS_FULL
- /// <summary>
- /// Verifies conditions that should be true for any valid state of this object.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Called by code contracts.")]
- [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called by code contracts.")]
- [ContractInvariantMethod]
- private void ObjectInvariant() {
- Contract.Invariant(this.Capabilities != null);
- }
-#endif
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs
index 9a43506..b0c543c 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs
@@ -157,7 +157,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
}
try {
- var associateRequest = AssociateRequest.Create(this.securitySettings, provider);
+ var associateRequest = AssociateRequestRelyingParty.Create(this.securitySettings, provider);
const int RenegotiateRetries = 1;
return this.CreateNewAssociation(provider, associateRequest, RenegotiateRetries);
@@ -193,10 +193,10 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
try {
var associateResponse = this.channel.Request(associateRequest);
- var associateSuccessfulResponse = associateResponse as AssociateSuccessfulResponse;
+ var associateSuccessfulResponse = associateResponse as AssociateSuccessfulResponseRelyingParty;
var associateUnsuccessfulResponse = associateResponse as AssociateUnsuccessfulResponse;
if (associateSuccessfulResponse != null) {
- Association association = associateSuccessfulResponse.CreateAssociation(associateRequest, null, null);
+ Association association = associateSuccessfulResponse.CreateAssociationAtRelyingParty(associateRequest);
this.associationStore.StoreAssociation(provider.Uri, association);
return association;
} else if (associateUnsuccessfulResponse != null) {
@@ -223,7 +223,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
associateUnsuccessfulResponse.AssociationType,
associateUnsuccessfulResponse.SessionType);
- associateRequest = AssociateRequest.Create(this.securitySettings, provider, associateUnsuccessfulResponse.AssociationType, associateUnsuccessfulResponse.SessionType);
+ associateRequest = AssociateRequestRelyingParty.Create(this.securitySettings, provider, associateUnsuccessfulResponse.AssociationType, associateUnsuccessfulResponse.SessionType);
return this.CreateNewAssociation(provider, associateRequest, retriesRemaining - 1);
} else {
throw new ProtocolException(MessagingStrings.UnexpectedMessageReceivedOfMany);
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IProviderEndpoint.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IProviderEndpoint.cs
deleted file mode 100644
index 5d8918d..0000000
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IProviderEndpoint.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IProviderEndpoint.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId.RelyingParty {
- using System;
- using System.Collections.ObjectModel;
- using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
- using System.Globalization;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId.Messages;
-
- /// <summary>
- /// Information published about an OpenId Provider by the
- /// OpenId discovery documents found at a user's Claimed Identifier.
- /// </summary>
- /// <remarks>
- /// Because information provided by this interface is suppplied by a
- /// user's individually published documents, it may be incomplete or inaccurate.
- /// </remarks>
- [ContractClass(typeof(IProviderEndpointContract))]
- public interface IProviderEndpoint {
- /// <summary>
- /// Gets the detected version of OpenID implemented by the Provider.
- /// </summary>
- Version Version { get; }
-
- /// <summary>
- /// Gets the URL that the OpenID Provider receives authentication requests at.
- /// </summary>
- /// <value>
- /// This value MUST be an absolute HTTP or HTTPS URL.
- /// </value>
- Uri Uri { get; }
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <typeparam name="T">The extension whose support is being queried.</typeparam>
- /// <returns>True if support for the extension is advertised. False otherwise.</returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "No parameter at all.")]
- [Obsolete("Use IAuthenticationRequest.DiscoveryResult.IsExtensionSupported instead.")]
- bool IsExtensionSupported<T>() where T : IOpenIdMessageExtension, new();
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <param name="extensionType">The extension whose support is being queried.</param>
- /// <returns>True if support for the extension is advertised. False otherwise.</returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- [Obsolete("Use IAuthenticationRequest.DiscoveryResult.IsExtensionSupported instead.")]
- bool IsExtensionSupported(Type extensionType);
- }
-
- /// <summary>
- /// Code contract for the <see cref="IProviderEndpoint"/> type.
- /// </summary>
- [ContractClassFor(typeof(IProviderEndpoint))]
- internal abstract class IProviderEndpointContract : IProviderEndpoint {
- /// <summary>
- /// Prevents a default instance of the <see cref="IProviderEndpointContract"/> class from being created.
- /// </summary>
- private IProviderEndpointContract() {
- }
-
- #region IProviderEndpoint Members
-
- /// <summary>
- /// Gets the detected version of OpenID implemented by the Provider.
- /// </summary>
- Version IProviderEndpoint.Version {
- get {
- Contract.Ensures(Contract.Result<Version>() != null);
- throw new System.NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the URL that the OpenID Provider receives authentication requests at.
- /// </summary>
- Uri IProviderEndpoint.Uri {
- get {
- Contract.Ensures(Contract.Result<Uri>() != null);
- throw new System.NotImplementedException();
- }
- }
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <typeparam name="T">The extension whose support is being queried.</typeparam>
- /// <returns>
- /// True if support for the extension is advertised. False otherwise.
- /// </returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- bool IProviderEndpoint.IsExtensionSupported<T>() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <param name="extensionType">The extension whose support is being queried.</param>
- /// <returns>
- /// True if support for the extension is advertised. False otherwise.
- /// </returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- bool IProviderEndpoint.IsExtensionSupported(Type extensionType) {
- Contract.Requires<ArgumentNullException>(extensionType != null);
- Contract.Requires<ArgumentException>(typeof(IOpenIdMessageExtension).IsAssignableFrom(extensionType));
- throw new NotImplementedException();
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs
index 290d29e..d39d2ca 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs
@@ -141,7 +141,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
cryptoKeyStore = new MemoryCryptoKeyStore();
}
- this.channel = new OpenIdChannel(cryptoKeyStore, nonceStore, this.SecuritySettings);
+ this.channel = new OpenIdRelyingPartyChannel(cryptoKeyStore, nonceStore, this.SecuritySettings);
this.AssociationManager = new AssociationManager(this.Channel, new CryptoKeyStoreAsRelyingPartyAssociationStore(cryptoKeyStore), this.SecuritySettings);
Reporting.RecordFeatureAndDependencyUse(this, cryptoKeyStore, nonceStore);
@@ -665,7 +665,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
internal static OpenIdRelyingParty CreateNonVerifying() {
OpenIdRelyingParty rp = new OpenIdRelyingParty();
try {
- rp.Channel = OpenIdChannel.CreateNonVerifyingChannel();
+ rp.Channel = OpenIdRelyingPartyChannel.CreateNonVerifyingChannel();
return rp;
} catch {
rp.Dispose();