diff options
| author | Arnaud Simon <arnaudsimon@apache.org> | 2008-09-26 11:12:43 +0000 |
|---|---|---|
| committer | Arnaud Simon <arnaudsimon@apache.org> | 2008-09-26 11:12:43 +0000 |
| commit | 4ca1e47bcdc45b47ce44455fcb2c3b955ca44259 (patch) | |
| tree | 06c7d8bbab7d50db5dff08d379cf201310cc27d2 /qpid/dotnet | |
| parent | 1c8f075b4f4ff2ef2d2fe23bca97f3fa9db4e10c (diff) | |
| download | qpid-python-4ca1e47bcdc45b47ce44455fcb2c3b955ca44259.tar.gz | |
qpid-1277: Implemented SASSL PLAIN authentication
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@699274 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet')
3 files changed, 25 insertions, 5 deletions
diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index f07609380f..be279d5243 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -57,7 +57,7 @@ namespace org.apache.qpid.client {
_log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host,
port, virtualHost, username));
- ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this);
+ ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password);
ManualResetEvent negotiationComplete = new ManualResetEvent(false);
connectionDelegate.setCondition(negotiationComplete);
connectionDelegate.VirtualHost = virtualHost;
diff --git a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs index c38dccce7a..5ed4187b36 100644 --- a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs @@ -18,6 +18,9 @@ */
using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
using System.Threading;
using org.apache.qpid.transport;
using org.apache.qpid.transport.util;
@@ -28,10 +31,14 @@ namespace org.apache.qpid.client {
private static readonly Logger log = Logger.get(typeof (ClientConnectionDelegate));
private readonly Client _client;
+ private string _username;
+ private string _password;
- public ClientConnectionDelegate(Client client)
+ public ClientConnectionDelegate(Client client, string username, string pasword)
{
_client = client;
+ _username = username;
+ _password = pasword;
}
public override SessionDelegate getSessionDelegate()
@@ -44,6 +51,20 @@ namespace org.apache.qpid.client throw t;
}
+ public override void connectionStart(Channel context, ConnectionStart mystruct)
+ {
+ const string mechanism = "PLAIN";
+ MemoryStream stResponse = new MemoryStream();
+ byte[] part = Encoding.UTF8.GetBytes(_username);
+ stResponse.WriteByte(0);
+ stResponse.Write(part, 0, part.Length);
+ stResponse.WriteByte(0);
+ part = Encoding.UTF8.GetBytes(_password);
+ stResponse.Write(part, 0, part.Length);
+ Dictionary<String, Object> props = new Dictionary<String, Object>();
+ context.connectionStartOk(props, mechanism, stResponse.ToArray(), "utf8");
+ }
+
public override void closed()
{
log.debug("Delegate closed");
@@ -61,7 +82,7 @@ namespace org.apache.qpid.client }
}
- public new void connectionClose(Channel context, ConnectionClose connectionClose)
+ public override void connectionClose(Channel context, ConnectionClose connectionClose)
{
base.connectionClose(context, connectionClose);
ErrorCode errorCode = ErrorCode.getErrorCode((int) connectionClose.getReplyCode());
diff --git a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs index ae3fb11fdd..1f76840b98 100644 --- a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs @@ -68,8 +68,7 @@ namespace org.apache.qpid.transport // Client side
//-----------------------------------------------
public override void connectionStart(Channel context, ConnectionStart mstruct)
- {
- // todo SASL
+ {
Dictionary<String, Object> props = new Dictionary<String, Object>();
context.connectionStartOk(props, null, null, "utf8");
}
|
