summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-07-20 07:01:58 -0600
committerAndrew Arnott <andrewarnott@gmail.com>2011-07-20 07:01:58 -0600
commit1328f88a36187d8aa5890a46e35af59c4df04d3f (patch)
treec42a3aad4aa21d39b91dcc87a912f8cb96c22c11 /src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs
parentd15895e626b73b6f96f561786b4b5c941c0a4bb1 (diff)
downloadDotNetOpenAuth-1328f88a36187d8aa5890a46e35af59c4df04d3f.zip
DotNetOpenAuth-1328f88a36187d8aa5890a46e35af59c4df04d3f.tar.gz
DotNetOpenAuth-1328f88a36187d8aa5890a46e35af59c4df04d3f.tar.bz2
Splitting up the OpenID profile into OpenID RP and OP. The core OpenID DLL compiles, but the RP and OP ones do not.
Diffstat (limited to 'src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs')
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs158
1 files changed, 0 insertions, 158 deletions
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs
index d9a0e50..2f1c7da 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs
@@ -18,8 +18,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OpenId.Extensions;
using DotNetOpenAuth.OpenId.Messages;
- using DotNetOpenAuth.OpenId.Provider;
- using DotNetOpenAuth.OpenId.RelyingParty;
/// <summary>
/// A channel that knows how to send and receive OpenID messages.
@@ -43,62 +41,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
private KeyValueFormEncoding keyValueForm = new KeyValueFormEncoding();
/// <summary>
- /// Initializes a new instance of the <see cref="OpenIdChannel"/> class
- /// for use by a Relying Party.
- /// </summary>
- /// <param name="cryptoKeyStore">The association store to use.</param>
- /// <param name="nonceStore">The nonce store to use.</param>
- /// <param name="securitySettings">The security settings to apply.</param>
- internal OpenIdChannel(ICryptoKeyStore cryptoKeyStore, INonceStore nonceStore, RelyingPartySecuritySettings securitySettings)
- : this(cryptoKeyStore, nonceStore, new OpenIdMessageFactory(), securitySettings, false) {
- Contract.Requires<ArgumentNullException>(securitySettings != null);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OpenIdChannel"/> class
- /// for use by a Provider.
- /// </summary>
- /// <param name="cryptoKeyStore">The OpenID Provider's association store or handle encoder.</param>
- /// <param name="nonceStore">The nonce store to use.</param>
- /// <param name="securitySettings">The security settings.</param>
- internal OpenIdChannel(IProviderAssociationStore cryptoKeyStore, INonceStore nonceStore, ProviderSecuritySettings securitySettings)
- : this(cryptoKeyStore, nonceStore, new OpenIdMessageFactory(), securitySettings) {
- Contract.Requires<ArgumentNullException>(cryptoKeyStore != null);
- Contract.Requires<ArgumentNullException>(securitySettings != null);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OpenIdChannel"/> class
- /// for use by a Relying Party.
- /// </summary>
- /// <param name="cryptoKeyStore">The association store to use.</param>
- /// <param name="nonceStore">The nonce store to use.</param>
- /// <param name="messageTypeProvider">An object that knows how to distinguish the various OpenID message types for deserialization purposes.</param>
- /// <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 OpenIdChannel(ICryptoKeyStore cryptoKeyStore, INonceStore nonceStore, IMessageFactory messageTypeProvider, RelyingPartySecuritySettings securitySettings, bool nonVerifying) :
- this(messageTypeProvider, InitializeBindingElements(cryptoKeyStore, nonceStore, securitySettings, nonVerifying)) {
- Contract.Requires<ArgumentNullException>(messageTypeProvider != null);
- Contract.Requires<ArgumentNullException>(securitySettings != null);
- Contract.Requires<ArgumentException>(!nonVerifying || securitySettings is RelyingPartySecuritySettings);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OpenIdChannel"/> class
- /// for use by a Provider.
- /// </summary>
- /// <param name="cryptoKeyStore">The association store to use.</param>
- /// <param name="nonceStore">The nonce store to use.</param>
- /// <param name="messageTypeProvider">An object that knows how to distinguish the various OpenID message types for deserialization purposes.</param>
- /// <param name="securitySettings">The security settings.</param>
- private OpenIdChannel(IProviderAssociationStore cryptoKeyStore, INonceStore nonceStore, IMessageFactory messageTypeProvider, ProviderSecuritySettings securitySettings) :
- this(messageTypeProvider, InitializeBindingElements(cryptoKeyStore, nonceStore, securitySettings)) {
- Contract.Requires<ArgumentNullException>(cryptoKeyStore != null);
- Contract.Requires<ArgumentNullException>(messageTypeProvider != null);
- Contract.Requires<ArgumentNullException>(securitySettings != null);
- }
-
- /// <summary>
/// Initializes a new instance of the <see cref="OpenIdChannel"/> class.
/// </summary>
/// <param name="messageTypeProvider">A class prepared to analyze incoming messages and indicate what concrete
@@ -135,24 +77,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
}
/// <summary>
- /// A value indicating whether the channel is set up
- /// with no functional security binding elements.
- /// </summary>
- /// <returns>A new <see cref="OpenIdChannel"/> instance that will not perform verification on incoming messages or apply any security to outgoing messages.</returns>
- /// <remarks>
- /// <para>A value of <c>true</c> allows the relying party to preview incoming
- /// messages without invalidating nonces or checking signatures.</para>
- /// <para>Setting this to <c>true</c> poses a great security risk and is only
- /// present to support the <see cref="OpenIdAjaxTextBox"/> which needs to preview
- /// messages, and will validate them later.</para>
- /// </remarks>
- internal static OpenIdChannel CreateNonVerifyingChannel() {
- Contract.Ensures(Contract.Result<OpenIdChannel>() != null);
-
- return new OpenIdChannel(null, null, new OpenIdMessageFactory(), new RelyingPartySecuritySettings(), true);
- }
-
- /// <summary>
/// Verifies the integrity and applicability of an incoming message.
/// </summary>
/// <param name="message">The message just received.</param>
@@ -300,87 +224,5 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
return response;
}
-
- /// <summary>
- /// Initializes the binding elements.
- /// </summary>
- /// <param name="cryptoKeyStore">The crypto key store.</param>
- /// <param name="nonceStore">The nonce store to use.</param>
- /// <param name="securitySettings">The security settings to apply. Must be an instance of either <see cref="RelyingPartySecuritySettings"/> or <see cref="ProviderSecuritySettings"/>.</param>
- /// <param name="nonVerifying">A value indicating whether the channel is set up with no functional security binding elements.</param>
- /// <returns>
- /// An array of binding elements which may be used to construct the channel.
- /// </returns>
- private static IChannelBindingElement[] InitializeBindingElements(ICryptoKeyStore cryptoKeyStore, INonceStore nonceStore, RelyingPartySecuritySettings securitySettings, bool nonVerifying) {
- Contract.Requires<ArgumentNullException>(securitySettings != null);
-
- SigningBindingElement signingElement;
- signingElement = nonVerifying ? null : new SigningBindingElement(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 RelyingPartySecurityOptions(securitySettings));
- elements.Add(new BackwardCompatibilityBindingElement());
- ReturnToNonceBindingElement requestNonceElement = null;
-
- if (cryptoKeyStore != null) {
- if (nonceStore != null) {
- // There is no point in having a ReturnToNonceBindingElement without
- // a ReturnToSignatureBindingElement because the nonce could be
- // artificially changed without it.
- requestNonceElement = new ReturnToNonceBindingElement(nonceStore, securitySettings);
- elements.Add(requestNonceElement);
- }
-
- // It is important that the return_to signing element comes last
- // so that the nonce is included in the signature.
- elements.Add(new ReturnToSignatureBindingElement(cryptoKeyStore));
- }
-
- ErrorUtilities.VerifyOperation(!securitySettings.RejectUnsolicitedAssertions || requestNonceElement != null, OpenIdStrings.UnsolicitedAssertionRejectionRequiresNonceStore);
-
- if (nonVerifying) {
- elements.Add(new SkipSecurityBindingElement());
- } else {
- if (nonceStore != null) {
- elements.Add(new StandardReplayProtectionBindingElement(nonceStore, true));
- }
-
- elements.Add(new StandardExpirationBindingElement());
- elements.Add(signingElement);
- }
-
- return elements.ToArray();
- }
-
- /// <summary>
- /// Initializes the binding elements.
- /// </summary>
- /// <param name="cryptoKeyStore">The OpenID Provider's crypto key store.</param>
- /// <param name="nonceStore">The nonce store to use.</param>
- /// <param name="securitySettings">The security settings to apply. Must be an instance of either <see cref="RelyingPartySecuritySettings"/> or <see cref="ProviderSecuritySettings"/>.</param>
- /// <returns>
- /// An array of binding elements which may be used to construct the channel.
- /// </returns>
- private static IChannelBindingElement[] InitializeBindingElements(IProviderAssociationStore cryptoKeyStore, INonceStore nonceStore, ProviderSecuritySettings securitySettings) {
- Contract.Requires<ArgumentNullException>(cryptoKeyStore != null);
- Contract.Requires<ArgumentNullException>(securitySettings != null);
- Contract.Requires<ArgumentNullException>(nonceStore != null);
-
- SigningBindingElement signingElement;
- signingElement = new SigningBindingElement(cryptoKeyStore, securitySettings);
-
- var extensionFactory = OpenIdExtensionFactoryAggregator.LoadFromConfiguration();
-
- List<IChannelBindingElement> elements = new List<IChannelBindingElement>(8);
- elements.Add(new ExtensionsBindingElement(extensionFactory, securitySettings));
- elements.Add(new StandardReplayProtectionBindingElement(nonceStore, true));
- elements.Add(new StandardExpirationBindingElement());
- elements.Add(signingElement);
-
- return elements.ToArray();
- }
}
}