diff options
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2.AuthorizationServer')
10 files changed, 0 insertions, 150 deletions
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs index 6511a11..a06555d 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.Configuration { using System; using System.Configuration; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OAuth2.ChannelElements; @@ -42,7 +41,6 @@ namespace DotNetOpenAuth.Configuration { /// </summary> internal static OAuth2AuthorizationServerSection Configuration { get { - Contract.Ensures(Contract.Result<OAuth2AuthorizationServerSection>() != null); return (OAuth2AuthorizationServerSection)ConfigurationManager.GetSection(SectionName) ?? new OAuth2AuthorizationServerSection(); } } diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.cs index 5fe16e9..b6aa75d 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.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.Text; @@ -28,7 +27,6 @@ namespace DotNetOpenAuth.OAuth2 { /// <returns>The client information. Never null.</returns> internal static IClientDescription GetClientOrThrow(this IAuthorizationServerHost authorizationServer, string clientIdentifier) { Requires.NotNullOrEmpty(clientIdentifier, "clientIdentifier"); - Contract.Ensures(Contract.Result<IClientDescription>() != null); try { var result = authorizationServer.GetClient(clientIdentifier); diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs index d20c450..5b47d0a 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2 { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Linq; #if CLR4 using System.Net.Http; @@ -195,7 +194,6 @@ namespace DotNetOpenAuth.OAuth2 { /// <returns>The authorization response message to send to the Client.</returns> public EndUserAuthorizationFailedResponse PrepareRejectAuthorizationRequest(EndUserAuthorizationRequest authorizationRequest, Uri callback = null) { Requires.NotNull(authorizationRequest, "authorizationRequest"); - Contract.Ensures(Contract.Result<EndUserAuthorizationFailedResponse>() != null); if (callback == null) { callback = this.GetCallback(authorizationRequest); @@ -216,7 +214,6 @@ namespace DotNetOpenAuth.OAuth2 { public EndUserAuthorizationSuccessResponseBase PrepareApproveAuthorizationRequest(EndUserAuthorizationRequest authorizationRequest, string userName, IEnumerable<string> scopes = null, Uri callback = null) { Requires.NotNull(authorizationRequest, "authorizationRequest"); Requires.NotNullOrEmpty(userName, "userName"); - Contract.Ensures(Contract.Result<EndUserAuthorizationSuccessResponseBase>() != null); if (callback == null) { callback = this.GetCallback(authorizationRequest); @@ -292,7 +289,6 @@ namespace DotNetOpenAuth.OAuth2 { /// <exception cref="ProtocolException">Thrown if no callback URL could be determined.</exception> protected Uri GetCallback(EndUserAuthorizationRequest authorizationRequest) { Requires.NotNull(authorizationRequest, "authorizationRequest"); - Contract.Ensures(Contract.Result<Uri>() != null); var client = this.AuthorizationServerServices.GetClientOrThrow(authorizationRequest.ClientIdentifier); diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs index a127166..7c9f808 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OAuth2 { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Security.Cryptography; using System.Text; diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs index bdba287..75744d4 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Security.Cryptography; using System.Text; using DotNetOpenAuth.Messaging; @@ -68,7 +67,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// <returns>A DataBag formatter.</returns> internal static IDataBagFormatter<AuthorizationCode> CreateFormatter(IAuthorizationServerHost authorizationServer) { Requires.NotNull(authorizationServer, "authorizationServer"); - Contract.Ensures(Contract.Result<IDataBagFormatter<AuthorizationCode>>() != null); var cryptoStore = authorizationServer.CryptoKeyStore; ErrorUtilities.VerifyHost(cryptoStore != null, OAuthStrings.ResultShouldNotBeNull, authorizationServer.GetType(), "CryptoKeyStore"); diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs index 28a00c5..6d4220b 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Globalization; using System.Linq; using System.Text; diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs index f611380..249f5e7 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Net.Mime; using System.Web; using DotNetOpenAuth.Messaging; diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs index 7881832..eb40617 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs @@ -6,7 +6,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { using System; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; using Validation; @@ -49,7 +48,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// </returns> internal static IDataBagFormatter<RefreshToken> CreateFormatter(ICryptoKeyStore cryptoKeyStore) { Requires.NotNull(cryptoKeyStore, "cryptoKeyStore"); - Contract.Ensures(Contract.Result<IDataBagFormatter<RefreshToken>>() != null); return new UriStyleMessageFormatter<RefreshToken>(cryptoKeyStore, RefreshTokenKeyBucket, signed: true, encrypted: true); } diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs index 549dd9f..6465307 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OAuth2 { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Security.Cryptography; using System.Text; @@ -20,7 +19,6 @@ namespace DotNetOpenAuth.OAuth2 { /// <summary> /// Provides host-specific authorization server services needed by this library. /// </summary> - [ContractClass(typeof(IAuthorizationServerHostContract))] public interface IAuthorizationServerHost { /// <summary> /// Gets the store for storing crypto keys used to symmetrically encrypt and sign authorization codes and refresh tokens. @@ -113,134 +111,4 @@ namespace DotNetOpenAuth.OAuth2 { /// </exception> AutomatedAuthorizationCheckResponse CheckAuthorizeClientCredentialsGrant(IAccessTokenRequest accessRequest); } - - /// <summary> - /// Code Contract for the <see cref="IAuthorizationServerHost" /> interface. - /// </summary> - [ContractClassFor(typeof(IAuthorizationServerHost))] - internal abstract class IAuthorizationServerHostContract : IAuthorizationServerHost { - /// <summary> - /// Prevents a default instance of the <see cref="IAuthorizationServerHostContract"/> class from being created. - /// </summary> - private IAuthorizationServerHostContract() { - } - - /// <summary> - /// Gets the store for storeing crypto keys used to symmetrically encrypt and sign authorization codes and refresh tokens. - /// </summary> - ICryptoKeyStore IAuthorizationServerHost.CryptoKeyStore { - get { - Contract.Ensures(Contract.Result<ICryptoKeyStore>() != null); - throw new NotImplementedException(); - } - } - - /// <summary> - /// Gets the authorization code nonce store to use to ensure that authorization codes can only be used once. - /// </summary> - /// <value>The authorization code nonce store.</value> - INonceStore IAuthorizationServerHost.NonceStore { - get { - Contract.Ensures(Contract.Result<INonceStore>() != null); - throw new NotImplementedException(); - } - } - - /// <summary> - /// Gets the client with a given identifier. - /// </summary> - /// <param name="clientIdentifier">The client identifier.</param> - /// <returns>The client registration. Never null.</returns> - /// <exception cref="ArgumentException">Thrown when no client with the given identifier is registered with this authorization server.</exception> - IClientDescription IAuthorizationServerHost.GetClient(string clientIdentifier) { - Requires.NotNullOrEmpty(clientIdentifier, "clientIdentifier"); - Contract.Ensures(Contract.Result<IClientDescription>() != null); - throw new NotImplementedException(); - } - - /// <summary> - /// Determines whether a described authorization is (still) valid. - /// </summary> - /// <param name="authorization">The authorization.</param> - /// <returns> - /// <c>true</c> if the original authorization is still valid; otherwise, <c>false</c>. - /// </returns> - /// <remarks> - /// <para>When establishing that an authorization is still valid, - /// it's very important to only match on recorded authorizations that - /// meet these criteria:</para> - /// 1) The client identifier matches. - /// 2) The user account matches. - /// 3) The scope on the recorded authorization must include all scopes in the given authorization. - /// 4) The date the recorded authorization was issued must be <em>no later</em> that the date the given authorization was issued. - /// <para>One possible scenario is where the user authorized a client, later revoked authorization, - /// and even later reinstated authorization. This subsequent recorded authorization - /// would not satisfy requirement #4 in the above list. This is important because the revocation - /// the user went through should invalidate all previously issued tokens as a matter of - /// security in the event the user was revoking access in order to sever authorization on a stolen - /// account or piece of hardware in which the tokens were stored. </para> - /// </remarks> - bool IAuthorizationServerHost.IsAuthorizationValid(IAuthorizationDescription authorization) { - Requires.NotNull(authorization, "authorization"); - throw new NotImplementedException(); - } - - /// <summary> - /// Determines whether a given set of resource owner credentials is valid based on the authorization server's user database - /// and if so records an authorization entry such that subsequent calls to <see cref="IAuthorizationServerHost.IsAuthorizationValid"/> would - /// return <c>true</c>. - /// </summary> - /// <param name="userName">Username on the account.</param> - /// <param name="password">The user's password.</param> - /// <param name="accessRequest"> - /// The access request the credentials came with. - /// This may be useful if the authorization server wishes to apply some policy based on the client that is making the request. - /// </param> - /// <returns> - /// A value that describes the result of the authorization check. - /// </returns> - /// <exception cref="NotSupportedException"> - /// May be thrown if the authorization server does not support the resource owner password credential grant type. - /// </exception> - AutomatedUserAuthorizationCheckResponse IAuthorizationServerHost.CheckAuthorizeResourceOwnerCredentialGrant(string userName, string password, IAccessTokenRequest accessRequest) { - Contract.Requires(!string.IsNullOrEmpty(userName)); - Contract.Requires(password != null); - Contract.Requires(accessRequest != null); - Contract.Ensures(Contract.Result<AutomatedUserAuthorizationCheckResponse>() != null); - throw new NotImplementedException(); - } - - /// <summary> - /// Determines whether an access token request given a client credential grant should be authorized - /// and if so records an authorization entry such that subsequent calls to <see cref="IAuthorizationServerHost.IsAuthorizationValid" /> would - /// return <c>true</c>. - /// </summary> - /// <param name="accessRequest">The access request the credentials came with. - /// This may be useful if the authorization server wishes to apply some policy based on the client that is making the request.</param> - /// <returns> - /// A value that describes the result of the authorization check. - /// </returns> - /// <exception cref="NotSupportedException">May be thrown if the authorization server does not support the client credential grant type.</exception> - AutomatedAuthorizationCheckResponse IAuthorizationServerHost.CheckAuthorizeClientCredentialsGrant(IAccessTokenRequest accessRequest) { - Contract.Requires(accessRequest != null); - Contract.Ensures(Contract.Result<AutomatedAuthorizationCheckResponse>() != null); - throw new NotImplementedException(); - } - - /// <summary> - /// Obtains parameters to go into the formulation of an access token. - /// </summary> - /// <param name="accessTokenRequestMessage">Details regarding the resources that the access token will grant access to, and the identity of the client - /// that will receive that access. - /// Based on this information the receiving resource server can be determined and the lifetime of the access - /// token can be set based on the sensitivity of the resources.</param> - /// <returns> - /// A non-null parameters instance that DotNetOpenAuth will dispose after it has been used. - /// </returns> - AccessTokenResult IAuthorizationServerHost.CreateAccessToken(IAccessTokenRequest accessTokenRequestMessage) { - Contract.Requires(accessTokenRequestMessage != null); - Contract.Ensures(Contract.Result<AccessTokenResult>() != null); - throw new NotImplementedException(); - } - } } diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Properties/AssemblyInfo.cs index 397b35d..29900ab 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Properties/AssemblyInfo.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/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. |