summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs')
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs
index 6d4220b..823baaf 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs
@@ -10,6 +10,8 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System.Globalization;
using System.Linq;
using System.Text;
+ using System.Threading;
+ using System.Threading.Tasks;
using DotNetOpenAuth.OAuth2.Messages;
using Messaging;
using Validation;
@@ -52,6 +54,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// Prepares a message for sending based on the rules of this channel binding element.
/// </summary>
/// <param name="message">The message to prepare for sending.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// The protections (if any) that this binding element applied to the message.
/// Null if this binding element did not even apply to this binding element.
@@ -60,7 +63,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// Implementations that provide message protection must honor the
/// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable.
/// </remarks>
- public override MessageProtections? ProcessOutgoingMessage(IProtocolMessage message) {
+ public override Task<MessageProtections?> ProcessOutgoingMessageAsync(IProtocolMessage message, CancellationToken cancellationToken) {
var accessTokenResponse = message as AccessTokenSuccessResponse;
if (accessTokenResponse != null) {
var directResponseMessage = (IDirectResponseProtocolMessage)accessTokenResponse;
@@ -68,7 +71,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
ErrorUtilities.VerifyProtocol(accessTokenRequest.GrantType != GrantType.ClientCredentials || accessTokenResponse.RefreshToken == null, OAuthStrings.NoGrantNoRefreshToken);
}
- return null;
+ return MessageProtectionTasks.Null;
}
/// <summary>
@@ -76,19 +79,19 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// validates an incoming message based on the rules of this channel binding element.
/// </summary>
/// <param name="message">The incoming message to process.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// The protections (if any) that this binding element applied to the message.
/// Null if this binding element did not even apply to this binding element.
/// </returns>
- /// <exception cref="ProtocolException">
- /// Thrown when the binding element rules indicate that this message is invalid and should
- /// NOT be processed.
- /// </exception>
+ /// <exception cref="TokenEndpointProtocolException">Thrown when an authorization or protocol rule is violated.</exception>
+ /// <exception cref="ProtocolException">Thrown when the binding element rules indicate that this message is invalid and should
+ /// NOT be processed.</exception>
/// <remarks>
/// Implementations that provide message protection must honor the
- /// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable.
+ /// <see cref="MessagePartAttribute.RequiredProtection" /> properties where applicable.
/// </remarks>
- public override MessageProtections? ProcessIncomingMessage(IProtocolMessage message) {
+ public override Task<MessageProtections?> ProcessIncomingMessageAsync(IProtocolMessage message, CancellationToken cancellationToken) {
bool applied = false;
// Check that the client secret is correct for client authenticated messages.
@@ -201,7 +204,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
}
}
- return applied ? (MessageProtections?)MessageProtections.None : null;
+ return applied ? MessageProtectionTasks.None : MessageProtectionTasks.Null;
}
}
}