directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r491658 - /directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java
Date Mon, 01 Jan 2007 22:14:53 GMT
Author: seelmann
Date: Mon Jan  1 14:14:52 2007
New Revision: 491658

URL: http://svn.apache.org/viewvc?view=rev&rev=491658
Log:
Fixed errors with ldaps and StartTLS, removed warnings

Modified:
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java?view=diff&rev=491658&r1=491657&r2=491658
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java
Mon Jan  1 14:14:52 2007
@@ -60,7 +60,7 @@
 
     private String credentials;
 
-    private Hashtable environment;
+    private Hashtable<String, String> environment;
 
     private InitialLdapContext context;
 
@@ -78,7 +78,7 @@
         ExtendedProgressMonitor monitor ) throws NamingException
     {
 
-        this.environment = new Hashtable();
+        this.environment = new Hashtable<String, String>();
         this.environment.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"
); //$NON-NLS-1$
         this.environment.put( "java.naming.ldap.version", "3" ); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -95,9 +95,7 @@
         {
             environment.put( Context.PROVIDER_URL, "ldaps://" + host + ":" + port ); //$NON-NLS-1$
//$NON-NLS-2$
             environment.put( Context.SECURITY_PROTOCOL, "ssl" ); //$NON-NLS-1$
-            environment
-                .put(
-                    "java.naming.ldap.factory.socket", "org.apache.directory.ldapstudio.browser.internal.model.DummySSLSocketFactory"
); //$NON-NLS-1$ //$NON-NLS-2$
+            environment.put( "java.naming.ldap.factory.socket", DummySSLSocketFactory.class.getName()
); //$NON-NLS-1$
         }
         else
         {
@@ -533,23 +531,7 @@
                                     return true;
                                 }
                             } );
-                            // SSLSession session = tls.negotiate(new
-                            // DummySSLSocketFactory());
-
-                            // System.out.println("Session: " +
-                            // session.toString());
-                            // System.out.println("Protocol: " +
-                            // session.getProtocol());
-                            // System.out.println("PeerHost: " +
-                            // session.getPeerHost());
-                            // System.out.println("CipherSuite: " +
-                            // session.getCipherSuite());
-                            // System.out.println("PeerCerts: " +
-                            // Arrays.asList(session.getPeerCertificates()));
-                            // //System.out.println("LocalCerts: " +
-                            // Arrays.asList(session.getLocalCertificates()));
-                            // System.out.println("SessionContext: " +
-                            // session.getSessionContext());
+                            tls.negotiate( new DummySSLSocketFactory() );
 
                         }
                         catch ( Exception e )
@@ -618,10 +600,15 @@
                 {
                     try
                     {
-                        environment.put( Context.SECURITY_AUTHENTICATION, authMethod );
-                        environment.put( Context.SECURITY_PRINCIPAL, principal );
-                        environment.put( Context.SECURITY_CREDENTIALS, credentials );
-                        context = new InitialLdapContext( environment, connCtls );
+                        context.removeFromEnvironment( Context.SECURITY_AUTHENTICATION );
+                        context.removeFromEnvironment( Context.SECURITY_PRINCIPAL );
+                        context.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
+
+                        context.addToEnvironment( Context.SECURITY_PRINCIPAL, principal );
+                        context.addToEnvironment( Context.SECURITY_CREDENTIALS, credentials
);
+                        context.addToEnvironment( Context.SECURITY_AUTHENTICATION, authMethod
);
+
+                        context.reconnect( context.getConnectControls() );
                     }
                     catch ( NamingException ne )
                     {



Mime
View raw message