diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-10-09 08:06:34 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-10-09 08:06:34 -0700 |
commit | 30b0475b757d7eba7cf779586bf1b567e76b6680 (patch) | |
tree | aee3d156e4e4fea132d3e9def10344672f349cc6 /src/DotNetOAuth/ChannelElements | |
parent | f36530e4bdd9b534fba3785a98a406ac387fbfac (diff) | |
download | DotNetOpenAuth-30b0475b757d7eba7cf779586bf1b567e76b6680.zip DotNetOpenAuth-30b0475b757d7eba7cf779586bf1b567e76b6680.tar.gz DotNetOpenAuth-30b0475b757d7eba7cf779586bf1b567e76b6680.tar.bz2 |
Removed ConsumerBase.ConsumerSecret, since the token manager can provide that.
Diffstat (limited to 'src/DotNetOAuth/ChannelElements')
3 files changed, 19 insertions, 12 deletions
diff --git a/src/DotNetOAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOAuth/ChannelElements/OAuthChannel.cs index 8006dd9..7741931 100644 --- a/src/DotNetOAuth/ChannelElements/OAuthChannel.cs +++ b/src/DotNetOAuth/ChannelElements/OAuthChannel.cs @@ -72,11 +72,11 @@ namespace DotNetOAuth.ChannelElements { this.webRequestHandler = webRequestHandler;
this.TokenManager = tokenManager;
- if (signingBindingElement.SignatureVerificationCallback != null) {
+ if (signingBindingElement.SignatureCallback != null) {
throw new ArgumentException(Strings.SigningElementAlreadyAssociatedWithChannel, "signingBindingElement");
}
- signingBindingElement.SignatureVerificationCallback = this.TokenSignatureVerificationCallback;
+ signingBindingElement.SignatureCallback = this.SignatureCallback;
}
/// <summary>
@@ -373,11 +373,12 @@ namespace DotNetOAuth.ChannelElements { }
/// <summary>
- /// Fills out the secrets in an incoming message so that signature verification can be performed.
+ /// Fills out the secrets in a message so that signing/verification can be performed.
/// </summary>
- /// <param name="message">The incoming message.</param>
- private void TokenSignatureVerificationCallback(ITamperResistantOAuthMessage message) {
+ /// <param name="message">The message about to be signed or whose signature is about to be verified.</param>
+ private void SignatureCallback(ITamperResistantOAuthMessage message) {
try {
+ Logger.Debug("Applying secrets to message to prepare for signing or signature verification.");
message.ConsumerSecret = this.TokenManager.GetConsumerSecret(message.ConsumerKey);
var tokenMessage = message as ITokenContainingMessage;
diff --git a/src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs b/src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs index 20eab0f..dab4c19 100644 --- a/src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs +++ b/src/DotNetOAuth/ChannelElements/SigningBindingElementBase.cs @@ -46,7 +46,7 @@ namespace DotNetOAuth.ChannelElements { /// Gets or sets the delegate that will initialize the non-serialized properties necessary on a signed
/// message so that its signature can be correctly calculated for verification.
/// </summary>
- public Action<ITamperResistantOAuthMessage> SignatureVerificationCallback { get; set; }
+ public Action<ITamperResistantOAuthMessage> SignatureCallback { get; set; }
/// <summary>
/// Creates a new object that is a copy of the current instance.
@@ -56,7 +56,7 @@ namespace DotNetOAuth.ChannelElements { /// </returns>
ITamperProtectionChannelBindingElement ITamperProtectionChannelBindingElement.Clone() {
ITamperProtectionChannelBindingElement clone = this.Clone();
- clone.SignatureVerificationCallback = this.SignatureVerificationCallback;
+ clone.SignatureCallback = this.SignatureCallback;
return clone;
}
@@ -72,6 +72,12 @@ namespace DotNetOAuth.ChannelElements { public bool PrepareMessageForSending(IProtocolMessage message) {
var signedMessage = message as ITamperResistantOAuthMessage;
if (signedMessage != null && this.IsMessageApplicable(signedMessage)) {
+ if (this.SignatureCallback != null) {
+ this.SignatureCallback(signedMessage);
+ } else {
+ Logger.Warn("Signing required, but callback delegate was not provided to provide additional data for signing.");
+ }
+
signedMessage.SignatureMethod = this.signatureMethod;
Logger.DebugFormat("Signing {0} message using {1}.", message.GetType().Name, this.signatureMethod);
signedMessage.Signature = this.GetSignature(signedMessage);
@@ -97,8 +103,8 @@ namespace DotNetOAuth.ChannelElements { return false;
}
- if (this.SignatureVerificationCallback != null) {
- this.SignatureVerificationCallback(signedMessage);
+ if (this.SignatureCallback != null) {
+ this.SignatureCallback(signedMessage);
} else {
Logger.Warn("Signature verification required, but callback delegate was not provided to provide additional data for signing.");
}
diff --git a/src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs b/src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs index dada28e..2d490d2 100644 --- a/src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs +++ b/src/DotNetOAuth/ChannelElements/SigningBindingElementChain.cs @@ -53,14 +53,14 @@ namespace DotNetOAuth.ChannelElements { /// message so that its signature can be correctly calculated for verification.
/// May be null for Consumers (who never have to verify signatures).
/// </summary>
- public Action<ITamperResistantOAuthMessage> SignatureVerificationCallback {
+ public Action<ITamperResistantOAuthMessage> SignatureCallback {
get {
- return this.signers[0].SignatureVerificationCallback;
+ return this.signers[0].SignatureCallback;
}
set {
foreach (ITamperProtectionChannelBindingElement signer in this.signers) {
- signer.SignatureVerificationCallback = value;
+ signer.SignatureCallback = value;
}
}
}
|