summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2013-02-21 09:32:23 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2013-02-21 09:32:23 -0800
commit10fc3ad3a7feda0cb5ab64aabe2e26bbce94595a (patch)
tree85a077c606521f5fcc5eb18c2eadf9834c2093af
parent82a38e5b7875b2ef48b16206e8019a02f90fee9a (diff)
downloadDotNetOpenAuth-10fc3ad3a7feda0cb5ab64aabe2e26bbce94595a.zip
DotNetOpenAuth-10fc3ad3a7feda0cb5ab64aabe2e26bbce94595a.tar.gz
DotNetOpenAuth-10fc3ad3a7feda0cb5ab64aabe2e26bbce94595a.tar.bz2
StyleCop fixes.
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HmacSha1HttpMessageHandler.cs20
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs45
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs22
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1RsaSha1HttpMessageHandler.cs20
5 files changed, 61 insertions, 48 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
index 619f252..501b5b2 100644
--- a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
@@ -1613,6 +1613,8 @@ namespace DotNetOpenAuth.Messaging {
/// <summary>
/// Enumerates all members of the collection as key=value pairs.
/// </summary>
+ /// <param name="nvc">The collection to enumerate.</param>
+ /// <returns>A sequence of pairs.</returns>
internal static IEnumerable<KeyValuePair<string, string>> AsKeyValuePairs(this NameValueCollection nvc) {
Requires.NotNull(nvc, "nvc");
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HmacSha1HttpMessageHandler.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HmacSha1HttpMessageHandler.cs
index 11de257..91a3b76 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HmacSha1HttpMessageHandler.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HmacSha1HttpMessageHandler.cs
@@ -33,6 +33,16 @@ namespace DotNetOpenAuth.OAuth {
}
/// <summary>
+ /// Gets the signature method to include in the oauth_signature_method parameter.
+ /// </summary>
+ /// <value>
+ /// The signature method.
+ /// </value>
+ protected override string SignatureMethod {
+ get { return "HMAC-SHA1"; }
+ }
+
+ /// <summary>
/// Calculates the signature for the specified buffer.
/// </summary>
/// <param name="signedPayload">The payload to calculate the signature for.</param>
@@ -45,15 +55,5 @@ namespace DotNetOpenAuth.OAuth {
return algorithm.ComputeHash(signedPayload);
}
}
-
- /// <summary>
- /// Gets the signature method to include in the oauth_signature_method parameter.
- /// </summary>
- /// <value>
- /// The signature method.
- /// </value>
- protected override string SignatureMethod {
- get { return "HMAC-SHA1"; }
- }
}
}
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs
index 84db4be..17d7b7a 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs
@@ -35,9 +35,12 @@ namespace DotNetOpenAuth.OAuth {
/// <summary>
/// The default nonce length.
/// </summary>
- private const int defaultNonceLength = 8;
+ private const int DefaultNonceLength = 8;
- private const OAuthParametersLocation defaultParametersLocation = OAuthParametersLocation.AuthorizationHttpHeader;
+ /// <summary>
+ /// The default parameters location.
+ /// </summary>
+ private const OAuthParametersLocation DefaultParametersLocation = OAuthParametersLocation.AuthorizationHttpHeader;
/// <summary>
/// The reference date and time for calculating time stamps.
@@ -53,8 +56,8 @@ namespace DotNetOpenAuth.OAuth {
/// Initializes a new instance of the <see cref="OAuth1HttpMessageHandlerBase"/> class.
/// </summary>
protected OAuth1HttpMessageHandlerBase() {
- this.NonceLength = defaultNonceLength;
- this.Location = defaultParametersLocation;
+ this.NonceLength = DefaultNonceLength;
+ this.Location = DefaultParametersLocation;
}
/// <summary>
@@ -63,8 +66,8 @@ namespace DotNetOpenAuth.OAuth {
/// <param name="innerHandler">The inner handler which is responsible for processing the HTTP response messages.</param>
protected OAuth1HttpMessageHandlerBase(HttpMessageHandler innerHandler)
: base(innerHandler) {
- this.NonceLength = defaultNonceLength;
- this.Location = defaultParametersLocation;
+ this.NonceLength = DefaultNonceLength;
+ this.Location = DefaultParametersLocation;
}
/// <summary>
@@ -120,7 +123,7 @@ namespace DotNetOpenAuth.OAuth {
public string AccessTokenSecret { get; set; }
/// <summary>
- /// Gets the length of the nonce.
+ /// Gets or sets the length of the nonce.
/// </summary>
/// <value>
/// The length of the nonce.
@@ -128,10 +131,19 @@ namespace DotNetOpenAuth.OAuth {
public int NonceLength { get; set; }
/// <summary>
+ /// Gets the signature method to include in the oauth_signature_method parameter.
+ /// </summary>
+ /// <value>
+ /// The signature method.
+ /// </value>
+ protected abstract string SignatureMethod { get; }
+
+ /// <summary>
/// Applies OAuth authorization to the specified request.
/// This method is applied automatically to outbound requests that use this message handler instance.
/// However this method may be useful for obtaining the OAuth 1.0 signature without actually sending the request.
/// </summary>
+ /// <param name="request">The request.</param>
public void ApplyAuthorization(HttpRequestMessage request) {
Requires.NotNull(request, "request");
@@ -175,14 +187,6 @@ namespace DotNetOpenAuth.OAuth {
protected abstract byte[] Sign(byte[] signedPayload);
/// <summary>
- /// Gets the signature method to include in the oauth_signature_method parameter.
- /// </summary>
- /// <value>
- /// The signature method.
- /// </value>
- protected abstract string SignatureMethod { get; }
-
- /// <summary>
/// Gets the OAuth 1.0 signature to apply to the specified request.
/// </summary>
/// <param name="request">The outbound HTTP request.</param>
@@ -228,6 +232,8 @@ namespace DotNetOpenAuth.OAuth {
/// <summary>
/// Returns the OAuth 1.0 timestamp for the current time.
/// </summary>
+ /// <param name="dateTime">The date time.</param>
+ /// <returns>A string representation of the number of seconds since "the epoch".</returns>
private static string ToTimeStamp(DateTime dateTime) {
Requires.Argument(dateTime.Kind == DateTimeKind.Utc, "dateTime", "UTC time required");
TimeSpan ts = dateTime - epoch;
@@ -239,7 +245,9 @@ namespace DotNetOpenAuth.OAuth {
/// Constructs the "Base String URI" as described in http://tools.ietf.org/html/rfc5849#section-3.4.1.2
/// </summary>
/// <param name="requestUri">The request URI.</param>
- /// <returns>The string to include in the signature base string.</returns>
+ /// <returns>
+ /// The string to include in the signature base string.
+ /// </returns>
private static string GetBaseStringUri(Uri requestUri) {
Requires.NotNull(requestUri, "requestUri");
@@ -253,7 +261,10 @@ namespace DotNetOpenAuth.OAuth {
/// Constructs the "Signature Base String" as described in http://tools.ietf.org/html/rfc5849#section-3.4.1
/// </summary>
/// <param name="request">The HTTP request message.</param>
- /// <returns>The signature base string.</returns>
+ /// <param name="oauthParameters">The oauth parameters.</param>
+ /// <returns>
+ /// The signature base string.
+ /// </returns>
private string ConstructSignatureBaseString(HttpRequestMessage request, NameValueCollection oauthParameters) {
Requires.NotNull(request, "request");
Requires.NotNull(oauthParameters, "oauthParameters");
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs
index 3cf14cd..b2e13d6 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1PlainTextMessageHandler.cs
@@ -19,13 +19,23 @@ namespace DotNetOpenAuth.OAuth {
/// </summary>
public class OAuth1PlainTextMessageHandler : OAuth1HttpMessageHandlerBase {
/// <summary>
+ /// Gets the signature method to include in the oauth_signature_method parameter.
+ /// </summary>
+ /// <value>
+ /// The signature method.
+ /// </value>
+ protected override string SignatureMethod {
+ get { return "PLAINTEXT"; }
+ }
+
+ /// <summary>
/// Calculates the signature for the specified buffer.
/// </summary>
/// <param name="signedPayload">The payload to calculate the signature for.</param>
/// <returns>
/// The signature.
/// </returns>
- /// <exception cref="System.NotImplementedException"></exception>
+ /// <exception cref="System.NotImplementedException">Always thrown.</exception>
protected override byte[] Sign(byte[] signedPayload) {
throw new NotImplementedException();
}
@@ -45,15 +55,5 @@ namespace DotNetOpenAuth.OAuth {
builder.Append(MessagingUtilities.EscapeUriDataStringRfc3986(this.AccessTokenSecret));
return builder.ToString();
}
-
- /// <summary>
- /// Gets the signature method to include in the oauth_signature_method parameter.
- /// </summary>
- /// <value>
- /// The signature method.
- /// </value>
- protected override string SignatureMethod {
- get { return "PLAINTEXT"; }
- }
}
}
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1RsaSha1HttpMessageHandler.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1RsaSha1HttpMessageHandler.cs
index cf0fb9c..fd2ad65 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1RsaSha1HttpMessageHandler.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1RsaSha1HttpMessageHandler.cs
@@ -25,6 +25,16 @@ namespace DotNetOpenAuth.OAuth {
public X509Certificate2 SigningCertificate { get; set; }
/// <summary>
+ /// Gets the signature method to include in the oauth_signature_method parameter.
+ /// </summary>
+ /// <value>
+ /// The signature method.
+ /// </value>
+ protected override string SignatureMethod {
+ get { return "RSA-SHA1"; }
+ }
+
+ /// <summary>
/// Calculates the signature for the specified buffer.
/// </summary>
/// <param name="signedPayload">The payload to calculate the signature for.</param>
@@ -37,15 +47,5 @@ namespace DotNetOpenAuth.OAuth {
byte[] binarySignature = provider.SignData(signedPayload, "SHA1");
return binarySignature;
}
-
- /// <summary>
- /// Gets the signature method to include in the oauth_signature_method parameter.
- /// </summary>
- /// <value>
- /// The signature method.
- /// </value>
- protected override string SignatureMethod {
- get { return "RSA-SHA1"; }
- }
}
}