summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-12-26 20:22:14 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-12-26 20:22:14 -0800
commit391397a341282d0c088bc9e9901ced9b19a62e5a (patch)
treebc1cc264acba9edc486eefbbfbb5fd4822111fb1 /src/DotNetOpenAuth.OAuth2
parent8f48e3f1daedb77e451f9fe8ac497741c6bb06f9 (diff)
parent3475fab579db0f6a1454ebc83d2e8a9c271e4c18 (diff)
downloadDotNetOpenAuth-391397a341282d0c088bc9e9901ced9b19a62e5a.zip
DotNetOpenAuth-391397a341282d0c088bc9e9901ced9b19a62e5a.tar.gz
DotNetOpenAuth-391397a341282d0c088bc9e9901ced9b19a62e5a.tar.bz2
Merge branch 'retargeting-contracts'
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2')
-rw-r--r--src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj7
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs8
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs54
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/StandardScopeSatisfiedCheck.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth2/packages.config4
10 files changed, 18 insertions, 66 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs
index 112e756..09eef2c 100644
--- a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs
+++ b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Configuration {
using System.Configuration;
- using System.Diagnostics.Contracts;
/// <summary>
/// Represents the &lt;oauth&gt; element in the host's .config file.
diff --git a/src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj b/src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj
index 696d8a9..b1b1d7f 100644
--- a/src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj
+++ b/src/DotNetOpenAuth.OAuth2/DotNetOpenAuth.OAuth2.csproj
@@ -43,6 +43,7 @@
</ItemGroup>
<ItemGroup>
<None Include="OAuth2\OAuth 2 client facades.cd" />
+ <None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="OAuth2\OAuthStrings.resx">
@@ -56,6 +57,12 @@
<Name>DotNetOpenAuth.Core</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <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>
<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.OAuth2/OAuth2/AccessToken.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs
index 5890d93..449b3ca 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs
@@ -7,11 +7,11 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OAuth2.ChannelElements;
+ using Validation;
/// <summary>
/// A short-lived token that accompanies HTTP requests to protected data to authorize the request.
@@ -51,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);
}
@@ -94,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 e966376..272b690 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs
@@ -8,8 +8,8 @@ namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
+ using Validation;
/// <summary>
/// A common message base class for OAuth messages.
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs
index e4a8a48..d90d1b5 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs
@@ -7,12 +7,12 @@
namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Net;
using System.Text;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth2.ChannelElements;
+ using Validation;
/// <summary>
/// A direct response sent in response to a rejected Bearer access token.
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs
index f28518f..f2acf79 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs
@@ -7,12 +7,12 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using DotNetOpenAuth.Messaging;
+ using Validation;
/// <summary>
/// Some common utility methods for OAuth 2.0.
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/StandardScopeSatisfiedCheck.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/StandardScopeSatisfiedCheck.cs
index 684e4a8..5fe0226 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/StandardScopeSatisfiedCheck.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/StandardScopeSatisfiedCheck.cs
@@ -6,6 +6,7 @@
namespace DotNetOpenAuth.OAuth2 {
using System.Collections.Generic;
+ using Validation;
/// <summary>
/// The default scope superset checker, which assumes that no scopes overlap.
diff --git a/src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs
index d89d8c1..df59ca5 100644
--- a/src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth2/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.OAuth2/packages.config b/src/DotNetOpenAuth.OAuth2/packages.config
new file mode 100644
index 0000000..10eec89
--- /dev/null
+++ b/src/DotNetOpenAuth.OAuth2/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