summaryrefslogtreecommitdiff
path: root/dotnet/Qpid.Client/Client/Handler/ConnectionSecureMethodHandler.cs
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-01-29 10:46:27 +0000
committerRobert Greig <rgreig@apache.org>2007-01-29 10:46:27 +0000
commit2bcc371558ce0659f53b86046cdf3d5de3b20910 (patch)
treed0c987cfa076eb90edb80620661d69a6e7354d3a /dotnet/Qpid.Client/Client/Handler/ConnectionSecureMethodHandler.cs
parentfe736211136b60bec61c1a22d3765be9142c6b39 (diff)
downloadqpid-python-2bcc371558ce0659f53b86046cdf3d5de3b20910.tar.gz
(Patch supplied by Tomas Restrepo) QPID-291-2.diff applied. Adds SASL capability to the .Net client.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@501001 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Client/Client/Handler/ConnectionSecureMethodHandler.cs')
-rw-r--r--dotnet/Qpid.Client/Client/Handler/ConnectionSecureMethodHandler.cs27
1 files changed, 25 insertions, 2 deletions
diff --git a/dotnet/Qpid.Client/Client/Handler/ConnectionSecureMethodHandler.cs b/dotnet/Qpid.Client/Client/Handler/ConnectionSecureMethodHandler.cs
index 7c0fbd8f40..fe123e6745 100644
--- a/dotnet/Qpid.Client/Client/Handler/ConnectionSecureMethodHandler.cs
+++ b/dotnet/Qpid.Client/Client/Handler/ConnectionSecureMethodHandler.cs
@@ -21,6 +21,7 @@
using Qpid.Client.Protocol;
using Qpid.Client.State;
using Qpid.Framing;
+using Qpid.Sasl;
namespace Qpid.Client.Handler
{
@@ -28,9 +29,31 @@ namespace Qpid.Client.Handler
{
public void MethodReceived(AMQStateManager stateManager, AMQMethodEvent evt)
{
- AMQFrame response = ConnectionSecureOkBody.CreateAMQFrame(evt.ChannelId, null);
- evt.ProtocolSession.WriteFrame(response);
+ ISaslClient saslClient = evt.ProtocolSession.SaslClient;
+ if ( saslClient == null )
+ {
+ throw new AMQException("No SASL client set up - cannot proceed with authentication");
+ }
+
+
+ ConnectionSecureBody body = (ConnectionSecureBody)evt.Method;
+
+ try
+ {
+ // Evaluate server challenge
+ byte[] response = saslClient.EvaluateChallenge(body.Challenge);
+ // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+ // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+ // Be aware of possible changes to parameter order as versions change.
+ AMQFrame responseFrame = ConnectionSecureOkBody.CreateAMQFrame(
+ evt.ChannelId, response);
+ evt.ProtocolSession.WriteFrame(responseFrame);
+ } catch ( SaslException e )
+ {
+ throw new AMQException("Error processing SASL challenge: " + e, e);
+ }
}
}
}
+