diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-26 20:22:14 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-26 20:22:14 -0800 |
commit | 391397a341282d0c088bc9e9901ced9b19a62e5a (patch) | |
tree | bc1cc264acba9edc486eefbbfbb5fd4822111fb1 /src/DotNetOpenAuth.OpenId.Provider | |
parent | 8f48e3f1daedb77e451f9fe8ac497741c6bb06f9 (diff) | |
parent | 3475fab579db0f6a1454ebc83d2e8a9c271e4c18 (diff) | |
download | DotNetOpenAuth-391397a341282d0c088bc9e9901ced9b19a62e5a.zip DotNetOpenAuth-391397a341282d0c088bc9e9901ced9b19a62e5a.tar.gz DotNetOpenAuth-391397a341282d0c088bc9e9901ced9b19a62e5a.tar.bz2 |
Merge branch 'retargeting-contracts'
Diffstat (limited to 'src/DotNetOpenAuth.OpenId.Provider')
29 files changed, 61 insertions, 290 deletions
diff --git a/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj b/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj index 524415f..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" /> @@ -67,17 +65,24 @@ <Project>{3896A32A-E876-4C23-B9B8-78E17D134CD3}</Project> <Name>DotNetOpenAuth.OpenId</Name> </ProjectReference> - <ProjectReference Include="..\Org.Mentalis.Security.Cryptography\Org.Mentalis.Security.Cryptography.csproj" > + <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" /> + <Reference Include="Validation, Version=2.0.0.0, Culture=neutral, PublicKeyToken=2fc06f0d701809a7, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\Validation.2.0.0.12319\lib\portable-windows8+net40+sl5+windowsphone8\Validation.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Folder Include="Configuration\" /> </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.targets" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))\EnlistmentInfo.targets" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))' != '' " /> diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs index c18bcac..45a69a5 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs @@ -7,13 +7,13 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OpenId.Extensions; using DotNetOpenAuth.OpenId.Provider; + using Validation; /// <summary> /// The messaging channel for OpenID Providers. diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs index 93d86d2..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; @@ -16,6 +15,7 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { using DotNetOpenAuth.Messaging.Reflection; using DotNetOpenAuth.OpenId.Messages; using DotNetOpenAuth.OpenId.Provider; + using Validation; /// <summary> /// The signing binding element for OpenID Providers. @@ -217,7 +217,7 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { /// the inclusion and order of message parts that will be signed. /// </returns> private string GetSignedParameterOrder(ITamperResistantOpenIdMessage signedMessage) { - Requires.ValidState(this.Channel != null); + RequiresEx.ValidState(this.Channel != null); Requires.NotNull(signedMessage, "signedMessage"); Protocol protocol = Protocol.Lookup(signedMessage.Version); 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 0fb5e98..a03c93f 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs @@ -7,11 +7,11 @@ 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> /// OpenID Provider tools for receiving association requests. diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs index c187d5e..f69de5e 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs @@ -7,11 +7,11 @@ namespace DotNetOpenAuth.OpenId.Messages { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.OpenId.ChannelElements; using DotNetOpenAuth.OpenId.Provider; + using Validation; /// <summary> /// The check_auth response message, as it is seen by the OpenID Provider. 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 6788a84..0000000 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProviderContract.cs +++ /dev/null @@ -1,96 +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; - - /// <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 f156b9a..9d73d9a 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs @@ -7,9 +7,9 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; + using Validation; /// <summary> /// Provides access to a host Provider to read an incoming extension-only checkid request message, @@ -31,7 +31,7 @@ namespace DotNetOpenAuth.OpenId.Provider { internal AnonymousRequest(OpenIdProvider provider, SignedResponseRequest request) : base(provider, request) { Requires.NotNull(provider, "provider"); - Requires.True(!(request is CheckIdRequest), "request"); + Requires.That(!(request is CheckIdRequest), "request", "request cannot be CheckIdRequest"); this.positiveResponse = new IndirectSignedResponse(request); } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs index f619b76..350ed5f 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs @@ -7,12 +7,12 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.IO; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; + using Validation; /// <summary> /// A signed and encrypted serialization of an association. @@ -58,6 +58,9 @@ namespace DotNetOpenAuth.OpenId.Provider { /// </summary> /// <param name="stream">The stream.</param> public void Serialize(Stream stream) { + Requires.NotNull(stream, "stream"); + Requires.That(stream.CanWrite, "stream", "requires stream.CanWrite"); + var writer = new BinaryWriter(stream); writer.Write(this.IsPrivateAssociation); writer.WriteBuffer(this.Secret); @@ -70,6 +73,9 @@ namespace DotNetOpenAuth.OpenId.Provider { /// </summary> /// <param name="stream">The stream.</param> public void Deserialize(Stream stream) { + Requires.NotNull(stream, "stream"); + Requires.That(stream.CanRead, "stream", "requires stream.CanRead"); + var reader = new BinaryReader(stream); this.IsPrivateAssociation = reader.ReadBoolean(); this.Secret = reader.ReadBuffer(256); @@ -88,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 e88af8a..0167580 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs @@ -6,9 +6,9 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; + using Validation; /// <summary> /// Implements the <see cref="IAuthenticationRequest"/> interface diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs index 661d719..91bb6f3 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs @@ -7,11 +7,11 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; + using Validation; /// <summary> /// Handles messages coming into an OpenID Provider for which the entire 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 946d354..d4332d2 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs @@ -8,13 +8,13 @@ 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; using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.Messages; + using Validation; /// <summary> /// A set of methods designed to assist in improving interop across different 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 bdf3e9b..8c4011b 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs @@ -7,11 +7,11 @@ namespace DotNetOpenAuth.OpenId.Provider { 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> /// OpenID Provider utility methods for HMAC-SHA* associations. @@ -43,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); @@ -61,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 67ecdb2..9c5004c 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs @@ -7,12 +7,12 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Net; using System.Text; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; + using Validation; /// <summary> /// A base class from which identity and non-identity RP requests can derive. diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs index 86c7e7c..550033b 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs @@ -7,6 +7,7 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Diagnostics.Contracts; + using Validation; /// <summary> /// An interface to provide custom identifiers for users logging into specific relying parties. @@ -16,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 @@ -40,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.True(((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 930abcd..e0f84b9 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs @@ -7,10 +7,10 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; + using Validation; /// <summary> /// Provides association serialization and deserialization. @@ -24,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. @@ -49,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.True(expiresUtc.Kind == DateTimeKind.Utc, "expiresUtc"); - 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 05a33bc..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; @@ -20,13 +19,13 @@ namespace DotNetOpenAuth.OpenId.Provider { using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OpenId.ChannelElements; using DotNetOpenAuth.OpenId.Messages; + using Validation; using RP = DotNetOpenAuth.OpenId.RelyingParty; /// <summary> /// 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 @@ -55,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> @@ -66,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> @@ -78,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; @@ -102,8 +95,7 @@ namespace DotNetOpenAuth.OpenId.Provider { [EditorBrowsable(EditorBrowsableState.Advanced)] public static IOpenIdApplicationStore HttpApplicationStore { get { - Requires.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); - Contract.Ensures(Contract.Result<IOpenIdApplicationStore>() != null); + RequiresEx.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); HttpContext context = HttpContext.Current; var store = (IOpenIdApplicationStore)context.Application[ApplicationStoreKey]; if (store == null) { @@ -131,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; } @@ -325,9 +316,9 @@ namespace DotNetOpenAuth.OpenId.Provider { [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "Code Contract requires that we cast early.")] [EditorBrowsable(EditorBrowsableState.Never)] public void SendResponse(IRequest request) { - Requires.ValidState(HttpContext.Current != null, MessagingStrings.CurrentHttpContextRequired); + RequiresEx.ValidState(HttpContext.Current != null, MessagingStrings.CurrentHttpContextRequired); Requires.NotNull(request, "request"); - Requires.True(request.IsResponseReady, "request"); + Requires.That(request.IsResponseReady, "request", OpenIdStrings.ResponseNotReady); this.ApplyBehaviorsToResponse(request); Request requestInternal = (Request)request; @@ -346,9 +337,9 @@ namespace DotNetOpenAuth.OpenId.Provider { /// <exception cref="InvalidOperationException">Thrown if <see cref="IRequest.IsResponseReady"/> is <c>false</c>.</exception> [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "Code Contract requires that we cast early.")] public void Respond(IRequest request) { - Requires.ValidState(HttpContext.Current != null, MessagingStrings.CurrentHttpContextRequired); + RequiresEx.ValidState(HttpContext.Current != null, MessagingStrings.CurrentHttpContextRequired); Requires.NotNull(request, "request"); - Requires.True(request.IsResponseReady, "request"); + Requires.That(request.IsResponseReady, "request", OpenIdStrings.ResponseNotReady); this.ApplyBehaviorsToResponse(request); Request requestInternal = (Request)request; @@ -364,7 +355,7 @@ namespace DotNetOpenAuth.OpenId.Provider { [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "Code Contract requires that we cast early.")] public OutgoingWebResponse PrepareResponse(IRequest request) { Requires.NotNull(request, "request"); - Requires.True(request.IsResponseReady, "request"); + Requires.That(request.IsResponseReady, "request", OpenIdStrings.ResponseNotReady); this.ApplyBehaviorsToResponse(request); Request requestInternal = (Request)request; @@ -387,9 +378,9 @@ namespace DotNetOpenAuth.OpenId.Provider { /// be the same as <paramref name="claimedIdentifier"/>.</param> /// <param name="extensions">The extensions.</param> public void SendUnsolicitedAssertion(Uri providerEndpoint, Realm relyingPartyRealm, Identifier claimedIdentifier, Identifier localIdentifier, params IExtensionMessage[] extensions) { - Requires.ValidState(HttpContext.Current != null, MessagingStrings.HttpContextRequired); + RequiresEx.ValidState(HttpContext.Current != null, MessagingStrings.HttpContextRequired); Requires.NotNull(providerEndpoint, "providerEndpoint"); - Requires.True(providerEndpoint.IsAbsoluteUri, "providerEndpoint"); + Requires.That(providerEndpoint.IsAbsoluteUri, "providerEndpoint", OpenIdStrings.AbsoluteUriRequired); Requires.NotNull(relyingPartyRealm, "relyingPartyRealm"); Requires.NotNull(claimedIdentifier, "claimedIdentifier"); Requires.NotNull(localIdentifier, "localIdentifier"); @@ -418,11 +409,11 @@ namespace DotNetOpenAuth.OpenId.Provider { /// </returns> public OutgoingWebResponse PrepareUnsolicitedAssertion(Uri providerEndpoint, Realm relyingPartyRealm, Identifier claimedIdentifier, Identifier localIdentifier, params IExtensionMessage[] extensions) { Requires.NotNull(providerEndpoint, "providerEndpoint"); - Requires.True(providerEndpoint.IsAbsoluteUri, "providerEndpoint"); + Requires.That(providerEndpoint.IsAbsoluteUri, "providerEndpoint", OpenIdStrings.AbsoluteUriRequired); Requires.NotNull(relyingPartyRealm, "relyingPartyRealm"); Requires.NotNull(claimedIdentifier, "claimedIdentifier"); Requires.NotNull(localIdentifier, "localIdentifier"); - Requires.ValidState(this.Channel.WebRequestHandler != null); + RequiresEx.ValidState(this.Channel.WebRequestHandler != null); // Although the RP should do their due diligence to make sure that this OP // is authorized to send an assertion for the given claimed identifier, diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs index ae7dede..9e46168 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs @@ -7,12 +7,12 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; using DotNetOpenAuth.OpenId.Provider; + using Validation; /// <summary> /// Utility methods for OpenID Providers. diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs index aaffa4c..2650e44 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs @@ -8,12 +8,12 @@ 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; using System.Text; using DotNetOpenAuth.Messaging; + using Validation; /// <summary> /// Provides standard PPID Identifiers to users to protect their identity from individual relying parties @@ -102,7 +102,7 @@ namespace DotNetOpenAuth.OpenId.Provider { } set { - Requires.InRange(value > 0, "value"); + Requires.Range(value > 0, "value"); this.newSaltLength = value; } } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs index 897b4f8..240e450 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs @@ -6,11 +6,11 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; - using System.Diagnostics.Contracts; using System.Threading; using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; + using Validation; /// <summary> /// Provides association storage in the association handle itself, but embedding signed and encrypted association diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs index 0786828..8eaae09 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs @@ -6,9 +6,9 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; + using Validation; /// <summary> /// An association storage mechanism that stores the association secrets in a private store, diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs index 21c1b51..ceabab3 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs @@ -7,19 +7,17 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; + using Validation; /// <summary> /// Implements the <see cref="IRequest"/> interface for all incoming /// request messages to an OpenID Provider. /// </summary> [Serializable] - [ContractClass(typeof(RequestContract))] - [ContractVerification(true)] internal abstract class Request : IRequest { /// <summary> /// The incoming request message. @@ -99,8 +97,7 @@ namespace DotNetOpenAuth.OpenId.Provider { /// <exception cref="InvalidOperationException">Thrown if <see cref="IsResponseReady"/> is <c>false</c>.</exception> internal IProtocolMessage Response { get { - Requires.ValidState(this.IsResponseReady, OpenIdStrings.ResponseNotReady); - Contract.Ensures(Contract.Result<IProtocolMessage>() != null); + RequiresEx.ValidState(this.IsResponseReady, OpenIdStrings.ResponseNotReady); 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 aa692d3..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 { - Requires.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. diff --git a/src/DotNetOpenAuth.OpenId.Provider/packages.config b/src/DotNetOpenAuth.OpenId.Provider/packages.config new file mode 100644 index 0000000..10eec89 --- /dev/null +++ b/src/DotNetOpenAuth.OpenId.Provider/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Validation" version="2.0.0.12319" targetFramework="net40" /> +</packages>
\ No newline at end of file |