diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-26 20:20:46 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-26 20:20:46 -0800 |
commit | 3475fab579db0f6a1454ebc83d2e8a9c271e4c18 (patch) | |
tree | bc1cc264acba9edc486eefbbfbb5fd4822111fb1 /src/DotNetOpenAuth.OAuth2/OAuth2 | |
parent | 002ce0e39af3b684ce6060dce60805e3333420fa (diff) | |
download | DotNetOpenAuth-3475fab579db0f6a1454ebc83d2e8a9c271e4c18.zip DotNetOpenAuth-3475fab579db0f6a1454ebc83d2e8a9c271e4c18.tar.gz DotNetOpenAuth-3475fab579db0f6a1454ebc83d2e8a9c271e4c18.tar.bz2 |
Removes more remnants of Code Contracts.
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2/OAuth2')
5 files changed, 2 insertions, 62 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs index d5799e5..449b3ca 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OAuth2 { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Security.Cryptography; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; @@ -52,9 +51,8 @@ namespace DotNetOpenAuth.OAuth2 { /// <param name="encryptingKey">The crypto service provider with the resource server's public key used to encrypt the access token.</param> /// <returns>An access token serializer.</returns> internal static IDataBagFormatter<AccessToken> CreateFormatter(RSACryptoServiceProvider signingKey, RSACryptoServiceProvider encryptingKey) { - Contract.Requires(signingKey != null || !signingKey.PublicOnly); - Contract.Requires(encryptingKey != null); - Contract.Ensures(Contract.Result<IDataBagFormatter<AccessToken>>() != null); + Requires.That(signingKey == null || !signingKey.PublicOnly, "signingKey", "requires private key"); + Requires.NotNull(encryptingKey, "encryptingKey"); return new UriStyleMessageFormatter<AccessToken>(signingKey, encryptingKey); } @@ -95,7 +93,6 @@ namespace DotNetOpenAuth.OAuth2 { /// </summary> /// <returns>A non-empty string.</returns> protected internal virtual string Serialize() { - Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>())); throw new NotSupportedException(); } diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs index 1ad0422..949fc94 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs @@ -7,14 +7,12 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; /// <summary> /// Describes a delegated authorization between a resource server, a client, and a user. /// </summary> - [ContractClass(typeof(IAuthorizationDescriptionContract))] public interface IAuthorizationDescription { /// <summary> /// Gets the identifier of the client authorized to access protected data. @@ -37,56 +35,4 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// </summary> HashSet<string> Scope { get; } } - - /// <summary> - /// Code contract for the <see cref="IAuthorizationDescription"/> interface. - /// </summary> - [ContractClassFor(typeof(IAuthorizationDescription))] - internal abstract class IAuthorizationDescriptionContract : IAuthorizationDescription { - /// <summary> - /// Prevents a default instance of the <see cref="IAuthorizationDescriptionContract"/> class from being created. - /// </summary> - private IAuthorizationDescriptionContract() { - } - - /// <summary> - /// Gets the identifier of the client authorized to access protected data. - /// </summary> - string IAuthorizationDescription.ClientIdentifier { - get { - Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>())); - throw new NotImplementedException(); - } - } - - /// <summary> - /// Gets the date this authorization was established or the token was issued. - /// </summary> - /// <value>A date/time expressed in UTC.</value> - DateTime IAuthorizationDescription.UtcIssued { - get { throw new NotImplementedException(); } - } - - /// <summary> - /// Gets the name on the account whose data on the resource server is accessible using this authorization, if applicable. - /// </summary> - /// <value>A username, or <c>null</c> if the authorization is to access the client's own data (not a distinct resource owner's data).</value> - string IAuthorizationDescription.User { - get { - // Null and non-empty are allowed, but not empty. - Contract.Ensures(Contract.Result<string>() != string.Empty); - throw new NotImplementedException(); - } - } - - /// <summary> - /// Gets the scope of operations the client is allowed to invoke. - /// </summary> - HashSet<string> IAuthorizationDescription.Scope { - get { - Contract.Ensures(Contract.Result<HashSet<string>>() != null); - throw new NotImplementedException(); - } - } - } } diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs index fd5503e..272b690 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2.Messages { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using Validation; diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs index f027f54..d90d1b5 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OAuth2.Messages { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Globalization; using System.Net; using System.Text; diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs index c4f56f0..f2acf79 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OAuth2 { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Globalization; using System.Linq; using System.Net; |