summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-02-09 19:53:09 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-02-09 19:53:09 -0800
commitdb132c3c9216833d05c4fb1bfea5f3d94190e02a (patch)
treeb45b2f382f0955c36b919f66997cc73cdc185e41
parent0b7175b2b2f791c5edf269bcd22282f9cb20b6dc (diff)
downloadDotNetOpenAuth-db132c3c9216833d05c4fb1bfea5f3d94190e02a.zip
DotNetOpenAuth-db132c3c9216833d05c4fb1bfea5f3d94190e02a.tar.gz
DotNetOpenAuth-db132c3c9216833d05c4fb1bfea5f3d94190e02a.tar.bz2
OAuth 1 assemblies now FxCop clean. #68
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs11
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs5
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs9
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs2
-rw-r--r--src/GlobalSuppressions.cs3
8 files changed, 17 insertions, 19 deletions
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
index 5cae301..673c23f 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
@@ -30,11 +30,10 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
internal OAuthConsumerChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, IConsumerTokenManager tokenManager, ConsumerSecuritySettings securitySettings, IMessageFactory messageFactory = null)
: base(
signingBindingElement,
- store,
tokenManager,
securitySettings,
messageFactory ?? new OAuthConsumerMessageFactory(),
- InitializeBindingElements(signingBindingElement, store, tokenManager, securitySettings)) {
+ InitializeBindingElements(signingBindingElement, store)) {
Requires.NotNull(tokenManager, "tokenManager");
Requires.NotNull(securitySettings, "securitySettings");
Requires.NotNull(signingBindingElement, "signingBindingElement");
@@ -56,15 +55,11 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// </summary>
/// <param name="signingBindingElement">The signing binding element.</param>
/// <param name="store">The nonce store.</param>
- /// <param name="tokenManager">The token manager.</param>
- /// <param name="securitySettings">The security settings.</param>
/// <returns>
/// An array of binding elements used to initialize the channel.
/// </returns>
- private static new IChannelBindingElement[] InitializeBindingElements(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, SecuritySettings securitySettings) {
- Contract.Requires(securitySettings != null);
-
- return OAuthChannel.InitializeBindingElements(signingBindingElement, store, tokenManager, securitySettings).ToArray();
+ private static new IChannelBindingElement[] InitializeBindingElements(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store) {
+ return OAuthChannel.InitializeBindingElements(signingBindingElement, store).ToArray();
}
}
}
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
index 137fc29..03e1b8e 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
@@ -6,6 +6,7 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
+ using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
@@ -15,6 +16,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// <summary>
/// A binding element that signs outgoing messages and verifies the signature on incoming messages.
/// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sha", Justification = "Acronym")]
public class RsaSha1ConsumerSigningBindingElement : RsaSha1SigningBindingElement {
/// <summary>
/// Initializes a new instance of the <see cref="RsaSha1ConsumerSigningBindingElement"/> class.
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs
index 6126c36..0d6450f 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs
@@ -30,7 +30,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
internal OAuthServiceProviderChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, IServiceProviderTokenManager tokenManager, ServiceProviderSecuritySettings securitySettings, IMessageFactory messageTypeProvider = null)
: base(
signingBindingElement,
- store,
tokenManager,
securitySettings,
messageTypeProvider ?? new OAuthServiceProviderMessageFactory(tokenManager),
@@ -59,10 +58,10 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// <returns>
/// An array of binding elements used to initialize the channel.
/// </returns>
- private static new IChannelBindingElement[] InitializeBindingElements(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, SecuritySettings securitySettings) {
+ private static IChannelBindingElement[] InitializeBindingElements(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, SecuritySettings securitySettings) {
Contract.Requires(securitySettings != null);
- var bindingElements = OAuthChannel.InitializeBindingElements(signingBindingElement, store, tokenManager, securitySettings);
+ var bindingElements = OAuthChannel.InitializeBindingElements(signingBindingElement, store);
var spTokenManager = tokenManager as IServiceProviderTokenManager;
var serviceProviderSecuritySettings = securitySettings as ServiceProviderSecuritySettings;
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs
index 16a8d26..d1324d4 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs
@@ -6,6 +6,7 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
+ using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
@@ -15,6 +16,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// <summary>
/// A binding element that signs outgoing messages and verifies the signature on incoming messages.
/// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sha", Justification = "Acronym")]
public class RsaSha1ServiceProviderSigningBindingElement : RsaSha1SigningBindingElement {
/// <summary>
/// The token manager for the service provider.
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs
index 3df7dfc..64e8a77 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs
@@ -6,6 +6,7 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
+ using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Text;
@@ -30,6 +31,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// <remarks>
/// This method signs the message per OAuth 1.0 section 9.2.
/// </remarks>
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "False positive.")]
protected override string GetSignature(ITamperResistantOAuthMessage message) {
string key = GetConsumerAndTokenSecretString(message);
using (HashAlgorithm hasher = new HMACSHA1(Encoding.ASCII.GetBytes(key))) {
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs
index b0a2e71..293bf5a 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs
@@ -30,7 +30,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// Initializes a new instance of the <see cref="OAuthChannel"/> class.
/// </summary>
/// <param name="signingBindingElement">The binding element to use for signing.</param>
- /// <param name="store">The web application store to use for nonces.</param>
/// <param name="tokenManager">The ITokenManager instance to use.</param>
/// <param name="securitySettings">The security settings.</param>
/// <param name="messageTypeProvider">An injected message type provider instance.
@@ -38,7 +37,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// OAuthConsumerMessageFactory or OAuthServiceProviderMessageFactory.</param>
/// <param name="bindingElements">The binding elements.</param>
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Diagnostics.Contracts.__ContractsRuntime.Requires<System.ArgumentNullException>(System.Boolean,System.String,System.String)", Justification = "Code contracts"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "securitySettings", Justification = "Code contracts")]
- protected OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, SecuritySettings securitySettings, IMessageFactory messageTypeProvider, IChannelBindingElement[] bindingElements)
+ protected OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, ITokenManager tokenManager, SecuritySettings securitySettings, IMessageFactory messageTypeProvider, IChannelBindingElement[] bindingElements)
: base(messageTypeProvider, bindingElements) {
Requires.NotNull(tokenManager, "tokenManager");
Requires.NotNull(securitySettings, "securitySettings");
@@ -90,14 +89,10 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// </summary>
/// <param name="signingBindingElement">The signing binding element.</param>
/// <param name="store">The nonce store.</param>
- /// <param name="tokenManager">The token manager.</param>
- /// <param name="securitySettings">The security settings.</param>
/// <returns>
/// An array of binding elements used to initialize the channel.
/// </returns>
- protected static List<IChannelBindingElement> InitializeBindingElements(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, SecuritySettings securitySettings) {
- Contract.Requires(securitySettings != null);
-
+ protected static List<IChannelBindingElement> InitializeBindingElements(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store) {
var bindingElements = new List<IChannelBindingElement> {
new OAuthHttpMethodBindingElement(),
signingBindingElement,
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs
index f417c24..58e4ada 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs
@@ -154,7 +154,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
Requires.NotNull(message, "message");
Requires.NotNullOrEmpty(message.HttpMethod, "message.HttpMethod");
Requires.NotNull(messageDictionary, "messageDictionary");
- ErrorUtilities.VerifyArgument(messageDictionary.Message == message, "Message references are not equal.");
+ ErrorUtilities.VerifyInternal(messageDictionary.Message == message, "Message references are not equal.");
List<string> signatureBaseStringElements = new List<string>(3);
diff --git a/src/GlobalSuppressions.cs b/src/GlobalSuppressions.cs
index 5079e5b..e276042 100644
--- a/src/GlobalSuppressions.cs
+++ b/src/GlobalSuppressions.cs
@@ -75,3 +75,6 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Scope = "member", Target = "DotNetOpenAuth.Messaging.IHttpDirectResponseContract.#DotNetOpenAuth.Messaging.IHttpDirectResponse.HttpStatusCode", Justification = "Code contract")]
[assembly: SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Scope = "member", Target = "DotNetOpenAuth.Messaging.IHttpDirectResponseContract.#DotNetOpenAuth.Messaging.IHttpDirectResponse.HttpStatusCode", Justification = "Code contract")]
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "DotNetOpenAuth.ComponentModel", Justification = "Types distributed across assemblies.")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "DotNetOpenAuth.OAuth")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "DotNetOpenAuth.OAuth.ChannelElements")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "DotNetOpenAuth.Messaging")]