Author: tabish
Date: Tue Mar 30 14:52:11 2010
New Revision: 929159

URL: http://svn.apache.org/viewvc?rev=929159&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQNET-239

Adds the ability to override the name supplied for the Server Certificate

Modified:
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs?rev=929159&r1=929158&r2=929159&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
 Tue Mar 30 14:52:11 2010
@@ -27,6 +27,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
 {
     public class SslTransport : TcpTransport
     {
+        private string serverName;
         private string clientCertLocation;
         private string clientCertPassword;
         
@@ -45,6 +46,17 @@ namespace Apache.NMS.ActiveMQ.Transport.
         }
 
         /// <summary>
+        /// Indicates the name of the Server's Certificate.  By default the 
Host name
+        /// of the remote server is used, however if this doesn't match the 
name of the
+        /// Server's certificate then this option can be set to override the 
default.
+        /// </summary>
+        public string ServerName
+        {
+            get { return this.serverName; }
+            set { this.serverName = value; }
+        }
+
+        /// <summary>
         /// Indicates the location of the Client Certificate to use when the 
Broker
         /// is configured for Client Auth (not common).  The SslTransport will 
supply
         /// this certificate to the SslStream via the SelectLocalCertificate 
method.
@@ -97,8 +109,9 @@ namespace Apache.NMS.ActiveMQ.Transport.
 
             try
             {
-                Tracer.Debug("Authorizing as Client for Server: " + 
this.RemoteAddress.Host);
-                sslStream.AuthenticateAsClient(this.RemoteAddress.Host);
+                string remoteCertName = this.serverName ?? 
this.RemoteAddress.Host;
+                Tracer.Debug("Authorizing as Client for Server: " + 
remoteCertName);
+                sslStream.AuthenticateAsClient(remoteCertName);
                 Tracer.Debug("Server is Authenticated = " + 
sslStream.IsAuthenticated);
                 Tracer.Debug("Server is Encrypted = " + 
sslStream.IsEncrypted);                
             }

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs?rev=929159&r1=929158&r2=929159&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
 Tue Mar 30 14:52:11 2010
@@ -23,6 +23,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
 {
        public class SslTransportFactory : TcpTransportFactory
        {
+        private string serverName;
         private string clientCertLocation;
         private string clientCertPassword;
         private bool acceptInvalidBrokerCert = false;
@@ -31,6 +32,12 @@ namespace Apache.NMS.ActiveMQ.Transport.
         {
         }
 
+        public string ServerName
+        {
+            get { return this.serverName; }
+            set { this.serverName = value; }
+        }
+
         public string ClientCertLocation
         {
             get { return this.clientCertLocation; }


Reply via email to