From 75fe6ffb45a46d42bbc6332987eb8dae5cac389d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 23 Jan 2009 07:52:40 -0800 Subject: [PATCH] StyleCop fixes --- .../ExtensionsBindingElementTests.cs | 45 +++++++++++----------- src/DotNetOpenAuth/Messaging/Channel.cs | 3 +- src/DotNetOpenAuth/Messaging/UserAgentResponse.cs | 1 + .../ChannelElements/SigningBindingElement.cs | 16 ++++---- 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs index 4f2c574..e0fac9e 100644 --- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs @@ -93,7 +93,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { public void ExtensionResponsesAreSigned() { Protocol protocol = Protocol.Default; var op = this.CreateProvider(); - IndirectSignedResponse response = CreateResponseWithExtensions(protocol); + IndirectSignedResponse response = this.CreateResponseWithExtensions(protocol); op.Channel.PrepareResponse(response); ITamperResistantOpenIdMessage signedResponse = (ITamperResistantOpenIdMessage)response; string extensionAliasKey = signedResponse.ExtraData.Single(kv => kv.Value == MockOpenIdExtension.MockTypeUri).Key; @@ -129,31 +129,10 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { op.SecuritySettings.SignOutgoingExtensions = false; op.Channel.Send(CreateResponseWithExtensions(protocol)); op.GetRequest().Response.Send(); // check_auth - } - ); + }); coordinator.Run(); } - private static void RegisterMockExtension(Channel channel) { - ErrorUtilities.VerifyArgumentNotNull(channel, "channel"); - - ((OpenIdExtensionFactory)channel.BindingElements.OfType().Single().ExtensionFactory).RegisterExtension(MockOpenIdExtension.Factory); - } - - /// - /// Creates a response message with one extensions. - /// - /// The protocol to construct the message with. - /// The message ready to send from OP to RP. - private IndirectSignedResponse CreateResponseWithExtensions(Protocol protocol) { - ErrorUtilities.VerifyArgumentNotNull(protocol, "protocol"); - - IndirectSignedResponse response = new IndirectSignedResponse(protocol.Version, RPUri); - response.ProviderEndpoint = ProviderUri; - response.Extensions.Add(new MockOpenIdExtension("pv", "ev")); - return response; - } - /// /// Verifies that two extensions with the same TypeURI cannot be applied to the same message. /// @@ -183,5 +162,25 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { where m.Success select m.Groups[1].Value; } + + private static void RegisterMockExtension(Channel channel) { + ErrorUtilities.VerifyArgumentNotNull(channel, "channel"); + + ((OpenIdExtensionFactory)channel.BindingElements.OfType().Single().ExtensionFactory).RegisterExtension(MockOpenIdExtension.Factory); + } + + /// + /// Creates a response message with one extensions. + /// + /// The protocol to construct the message with. + /// The message ready to send from OP to RP. + private IndirectSignedResponse CreateResponseWithExtensions(Protocol protocol) { + ErrorUtilities.VerifyArgumentNotNull(protocol, "protocol"); + + IndirectSignedResponse response = new IndirectSignedResponse(protocol.Version, RPUri); + response.ProviderEndpoint = ProviderUri; + response.Extensions.Add(new MockOpenIdExtension("pv", "ev")); + return response; + } } } diff --git a/src/DotNetOpenAuth/Messaging/Channel.cs b/src/DotNetOpenAuth/Messaging/Channel.cs index 7a1824f..4a3cb07 100644 --- a/src/DotNetOpenAuth/Messaging/Channel.cs +++ b/src/DotNetOpenAuth/Messaging/Channel.cs @@ -15,6 +15,7 @@ namespace DotNetOpenAuth.Messaging { using System.Linq; using System.Net; using System.Text; + using System.Threading; using System.Web; using DotNetOpenAuth.Messaging.Reflection; @@ -148,7 +149,7 @@ namespace DotNetOpenAuth.Messaging { /// Requires an HttpContext.Current context. /// public void Send(IProtocolMessage message) { - PrepareResponse(message).Send(); + this.PrepareResponse(message).Send(); } /// diff --git a/src/DotNetOpenAuth/Messaging/UserAgentResponse.cs b/src/DotNetOpenAuth/Messaging/UserAgentResponse.cs index 88233ba..d12d325 100644 --- a/src/DotNetOpenAuth/Messaging/UserAgentResponse.cs +++ b/src/DotNetOpenAuth/Messaging/UserAgentResponse.cs @@ -10,6 +10,7 @@ namespace DotNetOpenAuth.Messaging { using System.IO; using System.Net; using System.Text; + using System.Threading; using System.Web; /// diff --git a/src/DotNetOpenAuth/OpenId/ChannelElements/SigningBindingElement.cs b/src/DotNetOpenAuth/OpenId/ChannelElements/SigningBindingElement.cs index 70bd07d..be76832 100644 --- a/src/DotNetOpenAuth/OpenId/ChannelElements/SigningBindingElement.cs +++ b/src/DotNetOpenAuth/OpenId/ChannelElements/SigningBindingElement.cs @@ -10,24 +10,19 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { using System.Diagnostics; using System.Linq; using System.Net.Security; + using DotNetOpenAuth.Loggers; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.Messaging.Reflection; using DotNetOpenAuth.OpenId.Messages; using DotNetOpenAuth.OpenId.Provider; using DotNetOpenAuth.OpenId.RelyingParty; - using DotNetOpenAuth.Loggers; /// /// Signs and verifies authentication assertions. /// internal class SigningBindingElement : IChannelBindingElement { /// - /// A logger specifically used for logging verbose text on everything about the signing process. - /// - private static ILog SigningLogger = Logger.Create(typeof(SigningBindingElement)); - - /// /// The association store used by Relying Parties to look up the secrets needed for signing. /// private readonly IAssociationStore rpAssociations; @@ -44,6 +39,11 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { private readonly ProviderSecuritySettings opSecuritySettings; /// + /// A logger specifically used for logging verbose text on everything about the signing process. + /// + private static ILog signingLogger = Logger.Create(typeof(SigningBindingElement)); + + /// /// Initializes a new instance of the SigningBindingElement class for use by a Relying Party. /// /// The association store used to look up the secrets needed for signing. May be null for dumb Relying Parties. @@ -250,8 +250,8 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { byte[] dataToSign = KeyValueFormEncoding.GetBytes(parametersToSign); string signature = Convert.ToBase64String(association.Sign(dataToSign)); - if (SigningLogger.IsDebugEnabled) { - SigningLogger.DebugFormat( + if (signingLogger.IsDebugEnabled) { + signingLogger.DebugFormat( "Signing these message parts: {0}{1}{0}Base64 representation of signed data: {2}{0}Signature: {3}", Environment.NewLine, parametersToSign.ToStringDeferred(), -- 2.11.4.GIT