diff options
Diffstat (limited to 'src/DotNetOpenAuth.OpenId.Provider')
28 files changed, 10 insertions, 276 deletions
diff --git a/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj b/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj index ff1a6ab..d9fd749 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj +++ b/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj @@ -35,7 +35,6 @@ <Compile Include="OpenId\Messages\IAssociateRequestProvider.cs" /> <Compile Include="OpenId\Messages\AssociateRequestProviderTools.cs" /> <Compile Include="OpenId\Messages\IAssociateSuccessfulResponseProvider.cs" /> - <Compile Include="OpenId\Messages\IAssociateSuccessfulResponseProviderContract.cs" /> <Compile Include="OpenId\Messages\AssociateUnencryptedResponseProvider.cs" /> <Compile Include="OpenId\Messages\CheckAuthenticationResponseProvider.cs" /> <Compile Include="OpenId\Provider\OpenIdProviderUtilities.cs" /> @@ -53,7 +52,6 @@ <Compile Include="OpenId\Provider\IDirectedIdentityIdentifierProvider.cs" /> <Compile Include="OpenId\Provider\IErrorReporting.cs" /> <Compile Include="OpenId\Provider\Request.cs" /> - <Compile Include="OpenId\Provider\RequestContract.cs" /> <Compile Include="OpenId\Provider\StandardProviderApplicationStore.cs" /> <Compile Include="OpenId\Provider\OpenIdProvider.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs index fd765fd..45a69a5 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs index 3710c45..fbbf37a 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using System.Web; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs index c7e0ad9..ebcb534 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs @@ -6,7 +6,6 @@ namespace DotNetOpenAuth.OpenId.Messages { using System; - using System.Diagnostics.Contracts; using System.Security.Cryptography; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Reflection; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs index 3b3b6ce..a03c93f 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Messages { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs index b016a16..f69de5e 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Messages { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.OpenId.ChannelElements; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs index 070f235..df02a2c 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Messages { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; @@ -16,7 +15,6 @@ namespace DotNetOpenAuth.OpenId.Messages { /// <summary> /// An outgoing successful association response from the OpenID Provider. /// </summary> - [ContractClass(typeof(IAssociateSuccessfulResponseProviderContract))] internal interface IAssociateSuccessfulResponseProvider : IProtocolMessage { /// <summary> /// Gets or sets the expires in. diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProviderContract.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProviderContract.cs deleted file mode 100644 index 713493f..0000000 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProviderContract.cs +++ /dev/null @@ -1,97 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="IAssociateSuccessfulResponseProviderContract.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.OpenId.Messages { - using System; - using System.Collections.Generic; - using System.Diagnostics.Contracts; - using System.Linq; - using System.Text; - using DotNetOpenAuth.Messaging; - using DotNetOpenAuth.OpenId.Provider; - using Validation; - - /// <summary> - /// Code contract for the <see cref="IAssociateSuccessfulResponseProvider"/> interface. - /// </summary> - [ContractClassFor(typeof(IAssociateSuccessfulResponseProvider))] - internal abstract class IAssociateSuccessfulResponseProviderContract : IAssociateSuccessfulResponseProvider { - /// <summary> - /// Gets or sets the expires in. - /// </summary> - /// <value> - /// The expires in. - /// </value> - long IAssociateSuccessfulResponseProvider.ExpiresIn { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - /// <summary> - /// Gets or sets the association handle. - /// </summary> - /// <value> - /// The association handle. - /// </value> - string IAssociateSuccessfulResponseProvider.AssociationHandle { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - /// <summary> - /// Gets the level of protection this message requires. - /// </summary> - Messaging.MessageProtections Messaging.IProtocolMessage.RequiredProtection { - get { throw new NotImplementedException(); } - } - - /// <summary> - /// Gets a value indicating whether this is a direct or indirect message. - /// </summary> - Messaging.MessageTransport Messaging.IProtocolMessage.Transport { - get { throw new NotImplementedException(); } - } - - /// <summary> - /// Gets the version of the protocol or extension this message is prepared to implement. - /// </summary> - Version Messaging.IMessage.Version { - get { throw new NotImplementedException(); } - } - - /// <summary> - /// Gets the extra, non-standard Protocol parameters included in the message. - /// </summary> - IDictionary<string, string> Messaging.IMessage.ExtraData { - get { throw new NotImplementedException(); } - } - - /// <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> - /// <param name="associationStore">The Provider's association store.</param> - /// <param name="securitySettings">The security settings of the Provider.</param> - /// <returns> - /// The created association. - /// </returns> - Association IAssociateSuccessfulResponseProvider.CreateAssociationAtProvider(AssociateRequest request, IProviderAssociationStore associationStore, ProviderSecuritySettings securitySettings) { - Requires.NotNull(request, "request"); - Requires.NotNull(associationStore, "associationStore"); - Requires.NotNull(securitySettings, "securitySettings"); - throw new NotImplementedException(); - } - - /// <summary> - /// Checks the message state for conformity to the protocol specification - /// and throws an exception if the message is invalid. - /// </summary> - /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception> - void Messaging.IMessage.EnsureValidMessage() { - throw new NotImplementedException(); - } - } -} diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs index fd0cd6e..9d73d9a 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; using Validation; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs index 10e4dc0..350ed5f 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.IO; using System.Linq; using System.Text; @@ -95,7 +94,6 @@ namespace DotNetOpenAuth.OpenId.Provider { internal static IDataBagFormatter<AssociationDataBag> CreateFormatter(ICryptoKeyStore cryptoKeyStore, string bucket, TimeSpan? minimumAge = null) { Requires.NotNull(cryptoKeyStore, "cryptoKeyStore"); Requires.NotNullOrEmpty(bucket, "bucket"); - Contract.Ensures(Contract.Result<IDataBagFormatter<AssociationDataBag>>() != null); return new BinaryDataBagFormatter<AssociationDataBag>(cryptoKeyStore, bucket, signed: true, encrypted: true, minimumAge: minimumAge); } } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs index b323989..0167580 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs @@ -6,7 +6,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; using Validation; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs index 2261eb6..91bb6f3 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs index feb56eb..e12ca39 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider.Behaviors { using System; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Linq; using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging; @@ -17,6 +16,7 @@ namespace DotNetOpenAuth.OpenId.Provider.Behaviors { using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.Provider; using DotNetOpenAuth.OpenId.RelyingParty; + using Validation; /// <summary> /// Implements the Identity, Credential, & Access Management (ICAM) OpenID 2.0 Profile @@ -182,8 +182,8 @@ namespace DotNetOpenAuth.OpenId.Provider.Behaviors { /// <param name="maximumLifetime">The maximum lifetime.</param> /// <param name="securitySettings">The security settings to adjust.</param> private static void SetMaximumAssociationLifetimeToNotExceed(string associationType, TimeSpan maximumLifetime, ProviderSecuritySettings securitySettings) { - Contract.Requires(!string.IsNullOrEmpty(associationType)); - Contract.Requires(maximumLifetime.TotalSeconds > 0); + Requires.NotNullOrEmpty(associationType, "associationType"); + Requires.That(maximumLifetime.TotalSeconds > 0, "maximumLifetime", "requires positive timespan"); if (!securitySettings.AssociationLifetimes.ContainsKey(associationType) || securitySettings.AssociationLifetimes[associationType] > maximumLifetime) { securitySettings.AssociationLifetimes[associationType] = maximumLifetime; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs index 9b914d0..c8bdd93 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs @@ -7,7 +7,6 @@ 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; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs index e0b16fa..d4332d2 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Provider.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; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs index c5ede8c..278ad6c 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Provider.Extensions.UI { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Globalization; using System.Linq; using DotNetOpenAuth.Messaging; @@ -16,6 +15,7 @@ namespace DotNetOpenAuth.OpenId.Provider.Extensions.UI { using DotNetOpenAuth.OpenId.Messages; using DotNetOpenAuth.OpenId.Provider; using DotNetOpenAuth.Xrds; + using Validation; /// <summary> /// OpenID User Interface extension 1.0 request message. @@ -52,8 +52,8 @@ namespace DotNetOpenAuth.OpenId.Provider.Extensions.UI { /// </example> /// </remarks> public static IEnumerable<Uri> GetRelyingPartyIconUrls(Realm realm, IDirectWebRequestHandler webRequestHandler) { - Contract.Requires(realm != null); - Contract.Requires(webRequestHandler != null); + Requires.NotNull(realm, "realm"); + Requires.NotNull(webRequestHandler, "webRequestHandler"); ErrorUtilities.VerifyArgumentNotNull(realm, "realm"); ErrorUtilities.VerifyArgumentNotNull(webRequestHandler, "webRequestHandler"); diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs index a6812fa..8c4011b 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; @@ -44,7 +43,6 @@ namespace DotNetOpenAuth.OpenId.Provider { Requires.NotNullOrEmpty(associationType, "associationType"); Requires.NotNull(associationStore, "associationStore"); Requires.NotNull(securitySettings, "securitySettings"); - Contract.Ensures(Contract.Result<HmacShaAssociation>() != null); int secretLength = HmacShaAssociation.GetSecretLength(protocol, associationType); @@ -62,9 +60,9 @@ namespace DotNetOpenAuth.OpenId.Provider { string handle = associationStore.Serialize(secret, DateTime.UtcNow + lifetime, associationUse == AssociationRelyingPartyType.Dumb); - Contract.Assert(protocol != null); // All the way up to the method call, the condition holds, yet we get a Requires failure next - Contract.Assert(secret != null); - Contract.Assert(!string.IsNullOrEmpty(associationType)); + Assumes.True(protocol != null); // All the way up to the method call, the condition holds, yet we get a Requires failure next + Assumes.True(secret != null); + Assumes.True(!string.IsNullOrEmpty(associationType)); var result = HmacShaAssociation.Create(protocol, associationType, handle, secret, lifetime); return result; } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs index 1be0c47..9c5004c 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Net; using System.Text; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs index c72b901..550033b 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs @@ -17,7 +17,6 @@ namespace DotNetOpenAuth.OpenId.Provider { /// allowing the users to log into RPs without leaving any clue as to their true identity, /// and preventing multiple RPs from colluding to track user activity across realms. /// </remarks> - [ContractClass(typeof(IDirectedIdentityIdentifierProviderContract))] public interface IDirectedIdentityIdentifierProvider { /// <summary> /// Gets the Identifier to use for the Claimed Identifier and Local Identifier of @@ -41,44 +40,4 @@ namespace DotNetOpenAuth.OpenId.Provider { [Pure] bool IsUserLocalIdentifier(Identifier identifier); } - - /// <summary> - /// Contract class for the <see cref="IDirectedIdentityIdentifierProvider"/> type. - /// </summary> - [ContractClassFor(typeof(IDirectedIdentityIdentifierProvider))] - internal abstract class IDirectedIdentityIdentifierProviderContract : IDirectedIdentityIdentifierProvider { - #region IDirectedIdentityIdentifierProvider Members - - /// <summary> - /// Gets the Identifier to use for the Claimed Identifier and Local Identifier of - /// an outgoing positive assertion. - /// </summary> - /// <param name="localIdentifier">The OP local identifier for the authenticating user.</param> - /// <param name="relyingPartyRealm">The realm of the relying party receiving the assertion.</param> - /// <returns> - /// A valid, discoverable OpenID Identifier that should be used as the value for the - /// openid.claimed_id and openid.local_id parameters. Must not be null. - /// </returns> - Uri IDirectedIdentityIdentifierProvider.GetIdentifier(Identifier localIdentifier, Realm relyingPartyRealm) { - Requires.NotNull(localIdentifier, "localIdentifier"); - Requires.NotNull(relyingPartyRealm, "relyingPartyRealm"); - Requires.That(((IDirectedIdentityIdentifierProvider)this).IsUserLocalIdentifier(localIdentifier), "localIdentifier", OpenIdStrings.ArgumentIsPpidIdentifier); - throw new NotImplementedException(); - } - - /// <summary> - /// Determines whether a given identifier is the primary (non-PPID) local identifier for some user. - /// </summary> - /// <param name="identifier">The identifier in question.</param> - /// <returns> - /// <c>true</c> if the given identifier is the valid, unique identifier for some uesr (and NOT a PPID); otherwise, <c>false</c>. - /// </returns> - bool IDirectedIdentityIdentifierProvider.IsUserLocalIdentifier(Identifier identifier) { - Requires.NotNull(identifier, "identifier"); - - throw new NotImplementedException(); - } - - #endregion - } } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs index da7b116..e0f84b9 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; @@ -25,7 +24,6 @@ namespace DotNetOpenAuth.OpenId.Provider { /// to avoid disclosing the secret to anyone who sees the association handle, which itself isn't considered to /// be confidential. /// </remarks> - [ContractClass(typeof(IProviderAssociationStoreContract))] internal interface IProviderAssociationStore { /// <summary> /// Stores an association and returns a handle for it. @@ -50,42 +48,4 @@ namespace DotNetOpenAuth.OpenId.Provider { /// <exception cref="ProtocolException">Thrown if the association is not of the expected type.</exception> Association Deserialize(IProtocolMessage containingMessage, bool privateAssociation, string handle); } - - /// <summary> - /// Code contract for the <see cref="IProviderAssociationStore"/> interface. - /// </summary> - [ContractClassFor(typeof(IProviderAssociationStore))] - internal abstract class IProviderAssociationStoreContract : IProviderAssociationStore { - /// <summary> - /// Stores an association and returns a handle for it. - /// </summary> - /// <param name="secret">The association secret.</param> - /// <param name="expiresUtc">The expires UTC.</param> - /// <param name="privateAssociation">A value indicating whether this is a private association.</param> - /// <returns> - /// The association handle that represents this association. - /// </returns> - string IProviderAssociationStore.Serialize(byte[] secret, DateTime expiresUtc, bool privateAssociation) { - Requires.NotNull(secret, "secret"); - Requires.That(expiresUtc.Kind == DateTimeKind.Utc, "expiresUtc", "UTC required"); - Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>())); - throw new NotImplementedException(); - } - - /// <summary> - /// Retrieves an association given an association handle. - /// </summary> - /// <param name="containingMessage">The OpenID message that referenced this association handle.</param> - /// <param name="privateAssociation">A value indicating whether a private association is expected.</param> - /// <param name="handle">The association handle.</param> - /// <returns> - /// An association instance, or <c>null</c> if the association has expired or the signature is incorrect (which may be because the OP's symmetric key has changed). - /// </returns> - /// <exception cref="ProtocolException">Thrown if the association is not of the expected type.</exception> - Association IProviderAssociationStore.Deserialize(IProtocolMessage containingMessage, bool privateAssociation, string handle) { - Requires.NotNull(containingMessage, "containingMessage"); - Requires.NotNullOrEmpty(handle, "handle"); - throw new NotImplementedException(); - } - } } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs index 8c881c6..d96e5c9 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs @@ -11,7 +11,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Linq; using System.Threading; using System.Web; @@ -27,7 +26,6 @@ namespace DotNetOpenAuth.OpenId.Provider { /// Offers services for a web page that is acting as an OpenID identity server. /// </summary> [SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "By design")] - [ContractVerification(true)] public sealed class OpenIdProvider : IDisposable, IOpenIdHost { /// <summary> /// The name of the key to use in the HttpApplication cache to store the @@ -56,8 +54,6 @@ namespace DotNetOpenAuth.OpenId.Provider { /// </summary> public OpenIdProvider() : this(OpenIdElement.Configuration.Provider.ApplicationStore.CreateInstance(HttpApplicationStore)) { - Contract.Ensures(this.SecuritySettings != null); - Contract.Ensures(this.Channel != null); } /// <summary> @@ -67,8 +63,6 @@ namespace DotNetOpenAuth.OpenId.Provider { public OpenIdProvider(IOpenIdApplicationStore applicationStore) : this((INonceStore)applicationStore, (ICryptoKeyStore)applicationStore) { Requires.NotNull(applicationStore, "applicationStore"); - Contract.Ensures(this.SecuritySettings != null); - Contract.Ensures(this.Channel != null); } /// <summary> @@ -79,8 +73,6 @@ namespace DotNetOpenAuth.OpenId.Provider { private OpenIdProvider(INonceStore nonceStore, ICryptoKeyStore cryptoKeyStore) { Requires.NotNull(nonceStore, "nonceStore"); Requires.NotNull(cryptoKeyStore, "cryptoKeyStore"); - Contract.Ensures(this.SecuritySettings != null); - Contract.Ensures(this.Channel != null); this.SecuritySettings = OpenIdElement.Configuration.Provider.SecuritySettings.CreateSecuritySettings(); this.behaviors.CollectionChanged += this.OnBehaviorsChanged; @@ -104,7 +96,6 @@ namespace DotNetOpenAuth.OpenId.Provider { public static IOpenIdApplicationStore HttpApplicationStore { get { RequiresEx.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); - Contract.Ensures(Contract.Result<IOpenIdApplicationStore>() != null); HttpContext context = HttpContext.Current; var store = (IOpenIdApplicationStore)context.Application[ApplicationStoreKey]; if (store == null) { @@ -132,8 +123,7 @@ namespace DotNetOpenAuth.OpenId.Provider { /// </summary> public ProviderSecuritySettings SecuritySettings { get { - Contract.Ensures(Contract.Result<ProviderSecuritySettings>() != null); - Contract.Assume(this.securitySettings != null); + Assumes.True(this.securitySettings != null); return this.securitySettings; } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs index 69d0440..9e46168 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs index 8b1706a..2650e44 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Globalization; using System.Linq; using System.Security.Cryptography; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs index 526d825..240e450 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs @@ -6,7 +6,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; - using System.Diagnostics.Contracts; using System.Threading; using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs index ff2e10b..8eaae09 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs @@ -6,7 +6,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; using Validation; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs index ff7b45b..ceabab3 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; @@ -19,8 +18,6 @@ namespace DotNetOpenAuth.OpenId.Provider { /// request messages to an OpenID Provider. /// </summary> [Serializable] - [ContractClass(typeof(RequestContract))] - [ContractVerification(true)] internal abstract class Request : IRequest { /// <summary> /// The incoming request message. @@ -101,7 +98,6 @@ namespace DotNetOpenAuth.OpenId.Provider { internal IProtocolMessage Response { get { RequiresEx.ValidState(this.IsResponseReady, OpenIdStrings.ResponseNotReady); - Contract.Ensures(Contract.Result<IProtocolMessage>() != null); if (this.responseExtensions.Count > 0) { var extensibleResponse = this.ResponseMessage as IProtocolMessageWithExtensions; diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/RequestContract.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/RequestContract.cs deleted file mode 100644 index c4b96e8..0000000 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/RequestContract.cs +++ /dev/null @@ -1,48 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="RequestContract.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.OpenId.Provider { - using System; - using System.Collections.Generic; - using System.Diagnostics.Contracts; - using System.Linq; - using System.Text; - using DotNetOpenAuth.Messaging; - - /// <summary> - /// Code contract for the <see cref="Request"/> class. - /// </summary> - [ContractClassFor(typeof(Request))] - internal abstract class RequestContract : Request { - /// <summary> - /// Prevents a default instance of the <see cref="RequestContract"/> class from being created. - /// </summary> - private RequestContract() : base((Version)null, null) { - } - - /// <summary> - /// Gets a value indicating whether the response is ready to be sent to the user agent. - /// </summary> - /// <remarks> - /// This property returns false if there are properties that must be set on this - /// request instance before the response can be sent. - /// </remarks> - public override bool IsResponseReady { - get { throw new NotImplementedException(); } - } - - /// <summary> - /// Gets the response message, once <see cref="IsResponseReady"/> is <c>true</c>. - /// </summary> - protected override IProtocolMessage ResponseMessage { - get { - RequiresEx.ValidState(this.IsResponseReady); - Contract.Ensures(Contract.Result<IProtocolMessage>() != null); - throw new NotImplementedException(); - } - } - } -} diff --git a/src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs index 397b35d..29900ab 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs @@ -7,7 +7,6 @@ // We DON'T put an AssemblyVersionAttribute in here because it is generated in the build. using System; -using System.Diagnostics.Contracts; using System.Net; using System.Reflection; using System.Resources; @@ -31,8 +30,6 @@ using System.Web.UI; // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")] -[assembly: ContractVerification(true)] - #if StrongNameSigned // See comment at top of this file. We need this so that strong-naming doesn't // keep this assembly from being useful to shared host (medium trust) web sites. |