summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth.Consumer
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-09-18 07:40:02 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-09-18 07:40:02 -0700
commitcfe8dac81872ed4ba425864d550d66abcae581d2 (patch)
tree02908354efecbfb74caaf11538f6852148e74a53 /src/DotNetOpenAuth.OAuth.Consumer
parentd36e126e7daa6a0d106fa44692e931d489436bbf (diff)
downloadDotNetOpenAuth-cfe8dac81872ed4ba425864d550d66abcae581d2.zip
DotNetOpenAuth-cfe8dac81872ed4ba425864d550d66abcae581d2.tar.gz
DotNetOpenAuth-cfe8dac81872ed4ba425864d550d66abcae581d2.tar.bz2
All product assemblies build without ccrewrite.exe now.
Diffstat (limited to 'src/DotNetOpenAuth.OAuth.Consumer')
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs8
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs22
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs8
4 files changed, 20 insertions, 20 deletions
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
index 253b104..d0992bd 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
@@ -35,10 +35,10 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
securitySettings,
messageFactory ?? new OAuthConsumerMessageFactory(),
InitializeBindingElements(signingBindingElement, store, tokenManager, securitySettings)) {
- Contract.Requires<ArgumentNullException>(tokenManager != null);
- Contract.Requires<ArgumentNullException>(securitySettings != null);
- Contract.Requires<ArgumentNullException>(signingBindingElement != null);
- Contract.Requires<ArgumentException>(signingBindingElement.SignatureCallback == null, OAuthStrings.SigningElementAlreadyAssociatedWithChannel);
+ Requires.NotNull(tokenManager, "tokenManager");
+ Requires.NotNull(securitySettings, "securitySettings");
+ Requires.NotNull(signingBindingElement, "signingBindingElement");
+ Requires.True(signingBindingElement.SignatureCallback == null, "signingBindingElement", OAuthStrings.SigningElementAlreadyAssociatedWithChannel);
}
/// <summary>
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
index 7408789..7a7998e 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
@@ -21,7 +21,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// </summary>
/// <param name="signingCertificate">The certificate used to sign outgoing messages.</param>
public RsaSha1ConsumerSigningBindingElement(X509Certificate2 signingCertificate) {
- Contract.Requires<ArgumentNullException>(signingCertificate != null);
+ Requires.NotNull(signingCertificate, "signingCertificate");
this.SigningCertificate = signingCertificate;
}
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs
index 82ee92f..7ec1399 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs
@@ -27,8 +27,8 @@ namespace DotNetOpenAuth.OAuth {
/// <param name="serviceDescription">The endpoints and behavior of the Service Provider.</param>
/// <param name="tokenManager">The host's method of storing and recalling tokens and secrets.</param>
protected ConsumerBase(ServiceProviderDescription serviceDescription, IConsumerTokenManager tokenManager) {
- Contract.Requires<ArgumentNullException>(serviceDescription != null);
- Contract.Requires<ArgumentNullException>(tokenManager != null);
+ Requires.NotNull(serviceDescription, "serviceDescription");
+ Requires.NotNull(tokenManager, "tokenManager");
ITamperProtectionChannelBindingElement signingElement = serviceDescription.CreateTamperProtectionElement();
INonceStore store = new NonceMemoryStore(StandardExpirationBindingElement.MaximumMessageAge);
@@ -110,7 +110,7 @@ namespace DotNetOpenAuth.OAuth {
/// <param name="accessToken">The access token that permits access to the protected resource.</param>
/// <returns>The initialized WebRequest object.</returns>
public HttpWebRequest PrepareAuthorizedRequest(MessageReceivingEndpoint endpoint, string accessToken) {
- Contract.Requires<ArgumentNullException>(endpoint != null);
+ Requires.NotNull(endpoint, "endpoint");
Contract.Requires<ArgumentNullException>(!String.IsNullOrEmpty(accessToken));
return this.PrepareAuthorizedRequest(endpoint, accessToken, EmptyDictionary<string, string>.Instance);
@@ -125,9 +125,9 @@ namespace DotNetOpenAuth.OAuth {
/// <param name="extraData">Extra parameters to include in the message. Must not be null, but may be empty.</param>
/// <returns>The initialized WebRequest object.</returns>
public HttpWebRequest PrepareAuthorizedRequest(MessageReceivingEndpoint endpoint, string accessToken, IDictionary<string, string> extraData) {
- Contract.Requires<ArgumentNullException>(endpoint != null);
+ Requires.NotNull(endpoint, "endpoint");
Contract.Requires<ArgumentNullException>(!String.IsNullOrEmpty(accessToken));
- Contract.Requires<ArgumentNullException>(extraData != null);
+ Requires.NotNull(extraData, "extraData");
IDirectedProtocolMessage message = this.CreateAuthorizingMessage(endpoint, accessToken);
foreach (var pair in extraData) {
@@ -146,9 +146,9 @@ namespace DotNetOpenAuth.OAuth {
/// <param name="binaryData">Extra parameters to include in the message. Must not be null, but may be empty.</param>
/// <returns>The initialized WebRequest object.</returns>
public HttpWebRequest PrepareAuthorizedRequest(MessageReceivingEndpoint endpoint, string accessToken, IEnumerable<MultipartPostPart> binaryData) {
- Contract.Requires<ArgumentNullException>(endpoint != null);
- Contract.Requires<ArgumentException>(!String.IsNullOrEmpty(accessToken));
- Contract.Requires<ArgumentNullException>(binaryData != null);
+ Requires.NotNull(endpoint, "endpoint");
+ Requires.NotNullOrEmpty(accessToken, "accessToken");
+ Requires.NotNull(binaryData, "binaryData");
AccessProtectedResourceRequest message = this.CreateAuthorizingMessage(endpoint, accessToken);
foreach (MultipartPostPart part in binaryData) {
@@ -176,7 +176,7 @@ namespace DotNetOpenAuth.OAuth {
/// </remarks>
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "Type of parameter forces the method to apply only to specific scenario.")]
public HttpWebRequest PrepareAuthorizedRequest(AccessProtectedResourceRequest message) {
- Contract.Requires<ArgumentNullException>(message != null);
+ Requires.NotNull(message, "message");
return this.OAuthChannel.InitializeRequest(message);
}
@@ -214,7 +214,7 @@ namespace DotNetOpenAuth.OAuth {
/// <param name="accessToken">The access token that permits access to the protected resource.</param>
/// <returns>The initialized WebRequest object.</returns>
protected internal AccessProtectedResourceRequest CreateAuthorizingMessage(MessageReceivingEndpoint endpoint, string accessToken) {
- Contract.Requires<ArgumentNullException>(endpoint != null);
+ Requires.NotNull(endpoint, "endpoint");
Contract.Requires<ArgumentNullException>(!String.IsNullOrEmpty(accessToken));
AccessProtectedResourceRequest message = new AccessProtectedResourceRequest(endpoint, this.ServiceProvider.Version) {
@@ -276,7 +276,7 @@ namespace DotNetOpenAuth.OAuth {
/// The access token assigned by the Service Provider.
/// </returns>
protected AuthorizedTokenResponse ProcessUserAuthorization(string requestToken, string verifier) {
- Contract.Requires<ArgumentException>(!String.IsNullOrEmpty(requestToken));
+ Requires.NotNullOrEmpty(requestToken, "requestToken");
Contract.Ensures(Contract.Result<AuthorizedTokenResponse>() != null);
var requestAccess = new AuthorizedTokenRequest(this.ServiceProvider.AccessTokenEndpoint, this.ServiceProvider.Version) {
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs
index de37b80..e7d7f4f 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs
@@ -79,7 +79,7 @@ namespace DotNetOpenAuth.OAuth {
/// <param name="openIdAuthenticationRequest">The OpenID authentication request.</param>
/// <param name="scope">The scope of access that is requested of the service provider.</param>
public void AttachAuthorizationRequest(IAuthenticationRequest openIdAuthenticationRequest, string scope) {
- Contract.Requires<ArgumentNullException>(openIdAuthenticationRequest != null);
+ Requires.NotNull(openIdAuthenticationRequest, "openIdAuthenticationRequest");
var authorizationRequest = new AuthorizationRequest {
Consumer = this.ConsumerKey,
@@ -101,8 +101,8 @@ namespace DotNetOpenAuth.OAuth {
/// The token manager instance must implement <see cref="IOpenIdOAuthTokenManager"/>.
/// </remarks>
public AuthorizedTokenResponse ProcessUserAuthorization(IAuthenticationResponse openIdAuthenticationResponse) {
- Contract.Requires<ArgumentNullException>(openIdAuthenticationResponse != null);
- Contract.Requires<InvalidOperationException>(this.TokenManager is IOpenIdOAuthTokenManager);
+ Requires.NotNull(openIdAuthenticationResponse, "openIdAuthenticationResponse");
+ Requires.ValidState(this.TokenManager is IOpenIdOAuthTokenManager);
var openidTokenManager = this.TokenManager as IOpenIdOAuthTokenManager;
ErrorUtilities.VerifyOperation(openidTokenManager != null, OAuthStrings.OpenIdOAuthExtensionRequiresSpecialTokenManagerInterface, typeof(IOpenIdOAuthTokenManager).FullName);
@@ -140,7 +140,7 @@ namespace DotNetOpenAuth.OAuth {
/// <param name="request">The incoming HTTP request.</param>
/// <returns>The access token, or null if no incoming authorization message was recognized.</returns>
public AuthorizedTokenResponse ProcessUserAuthorization(HttpRequestInfo request) {
- Contract.Requires<ArgumentNullException>(request != null);
+ Requires.NotNull(request, "request");
UserAuthorizationResponse authorizationMessage;
if (this.Channel.TryReadFromRequest<UserAuthorizationResponse>(request, out authorizationMessage)) {