Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 6985 invoked from network); 27 May 2009 16:51:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 May 2009 16:51:48 -0000 Received: (qmail 80501 invoked by uid 500); 27 May 2009 16:52:00 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 80438 invoked by uid 500); 27 May 2009 16:52:00 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 80429 invoked by uid 99); 27 May 2009 16:52:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 May 2009 16:52:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 May 2009 16:51:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AD4AB238889C; Wed, 27 May 2009 16:51:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r779237 - in /directory/studio/trunk: connection-core/src/main/java/org/apache/directory/studio/connection/core/ connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ connection-ui/ connection-ui/src/main/java/o... Date: Wed, 27 May 2009 16:51:30 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090527165131.AD4AB238889C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Wed May 27 16:51:29 2009 New Revision: 779237 URL: http://svn.apache.org/viewvc?rev=779237&view=rev Log: DIRSTUDIO-263 (Add certificate validation for ldaps and StartTLS): o Added key store for temporary trusted certificates o Added preference page to manage trusted certificates o Moved content of LDAP preference page to Connections preference page Added: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/StudioKeyStoreManager.java (with props) directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java (with props) directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java (with props) directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/Messages.java (with props) directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages.properties (with props) directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_de.properties (with props) directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_fr.properties (with props) directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java (with props) Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/Messages.java directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioTrustManager.java directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages.properties directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_de.properties directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_fr.properties directory/studio/trunk/connection-ui/plugin.properties directory/studio/trunk/connection-ui/plugin.xml directory/studio/trunk/connection-ui/plugin_de.properties directory/studio/trunk/connection-ui/plugin_fr.properties directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/CertificateTrustDialog.java directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages.properties directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_de.properties directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_fr.properties directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java Wed May 27 16:51:29 2009 @@ -48,6 +48,13 @@ */ public class ConnectionCorePlugin extends Plugin { + + /** The file name of the permanent trust store */ + private static final String PERMANENT_TRUST_STORE = "permanent.jks"; //$NON-NLS-1$ + + /** The password of the permanent trust store */ + private static final String PERMANENT_TRUST_STORE_PASSWORD = "changeit"; //$NON-NLS-1$ + /** The shared instance */ private static ConnectionCorePlugin plugin; @@ -57,6 +64,12 @@ /** The connection folder manager */ private ConnectionFolderManager connectionFolderManager; + /** The permanent trust store */ + private StudioKeyStoreManager permanentTrustStoreManager; + + /** The session trust store */ + private StudioKeyStoreManager sessionTrustStoreManager; + /** The event runner. */ private EventRunner eventRunner; @@ -109,6 +122,17 @@ { connectionFolderManager = new ConnectionFolderManager(); } + + if ( permanentTrustStoreManager == null ) + { + permanentTrustStoreManager = StudioKeyStoreManager.createFileKeyStoreManager( PERMANENT_TRUST_STORE, + PERMANENT_TRUST_STORE_PASSWORD ); + } + + if ( sessionTrustStoreManager == null ) + { + sessionTrustStoreManager = StudioKeyStoreManager.createMemoryKeyStoreManager(); + } } @@ -139,6 +163,16 @@ { connectionFolderManager = null; } + + if ( permanentTrustStoreManager != null ) + { + permanentTrustStoreManager = null; + } + + if ( sessionTrustStoreManager != null ) + { + sessionTrustStoreManager = null; + } } @@ -188,6 +222,28 @@ /** + * Gets the permanent trust store manager. + * + * @return the permanent trust store manager + */ + public StudioKeyStoreManager getPermanentTrustStoreManager() + { + return permanentTrustStoreManager; + } + + + /** + * Gets the session trust store manager. + * + * @return the session trust store manager + */ + public StudioKeyStoreManager getSessionTrustStoreManager() + { + return sessionTrustStoreManager; + } + + + /** * Gets the authentication handler * * @return @@ -195,7 +251,7 @@ */ public IAuthHandler getAuthHandler() { - if(authHandler == null) + if ( authHandler == null ) { // if no authentication handler was set a default authentication handler is used // that only works if the bind password is stored within the connection parameters. @@ -203,14 +259,16 @@ { public ICredentials getCredentials( ConnectionParameter connectionParameter ) { - if ( connectionParameter.getBindPrincipal() == null || "".equals( connectionParameter.getBindPrincipal() ) ) //$NON-NLS-1$ + if ( connectionParameter.getBindPrincipal() == null + || "".equals( connectionParameter.getBindPrincipal() ) ) //$NON-NLS-1$ { return new Credentials( "", "", connectionParameter ); //$NON-NLS-1$ //$NON-NLS-2$ } - else if ( connectionParameter.getBindPassword() != null && !"".equals( connectionParameter.getBindPassword() ) ) //$NON-NLS-1$ + else if ( connectionParameter.getBindPassword() != null + && !"".equals( connectionParameter.getBindPassword() ) ) //$NON-NLS-1$ { - return new Credentials( connectionParameter.getBindPrincipal(), connectionParameter.getBindPassword(), - connectionParameter ); + return new Credentials( connectionParameter.getBindPrincipal(), connectionParameter + .getBindPassword(), connectionParameter ); } else { @@ -245,7 +303,7 @@ */ public IReferralHandler getReferralHandler() { - if(referralHandler == null) + if ( referralHandler == null ) { // if no referral handler was set a default referral handler is used // that just cancels referral chasing @@ -255,7 +313,7 @@ { // null cancels referral chasing return null; - } + } }; } return referralHandler; @@ -308,7 +366,7 @@ { this.certificateHandler = certificateHandler; } - + /** * Gets the LDIF modification logger. @@ -440,9 +498,8 @@ { // We can't use the PLUGIN_ID constant since loading the plugin.properties file has failed, // So we're using a default plugin id. - getLog().log( - new Status( Status.ERROR, "org.apache.directory.studio.connection.core", Status.OK, //$NON-NLS-1$ - Messages.error__unable_to_get_plugin_properties, e ) ); + getLog().log( new Status( Status.ERROR, "org.apache.directory.studio.connection.core", Status.OK, //$NON-NLS-1$ + Messages.error__unable_to_get_plugin_properties, e ) ); } } Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/Messages.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/Messages.java?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/Messages.java (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/Messages.java Wed May 27 16:51:29 2009 @@ -85,10 +85,10 @@ public static String jobs__close_connections_error_1; public static String jobs__close_connections_error_n; - public static String StudioTrustManager_CantAddCertificateToPermanentTrustStore; + public static String StudioTrustManager_CantCreateTrustManager; - public static String StudioTrustManager_CantCreatePermanentTrustManager; - - public static String StudioTrustManager_CantLoadPermanentTrustStore; + public static String StudioKeyStoreManager_CantAddCertificateToTrustStore; + public static String StudioKeyStoreManager_CantRemoveCertificateFromTrustStore; + public static String StudioKeyStoreManager_CantReadTrustStore; } Added: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/StudioKeyStoreManager.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/StudioKeyStoreManager.java?rev=779237&view=auto ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/StudioKeyStoreManager.java (added) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/StudioKeyStoreManager.java Wed May 27 16:51:29 2009 @@ -0,0 +1,331 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.studio.connection.core; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; + + +/** + * A wrapper around {@link KeyStore}. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class StudioKeyStoreManager +{ + public enum Type + { + File, Memory + } + + /** The type */ + private Type type; + + /** The filename of the underlying key store, only relevant for type File */ + private String filename; + + /** The password of the underlying key store, only relevant for type File */ + private String password; + + /** The in-memory key store, only relevant for type Memory */ + private KeyStore memoryKeyStore; + + + /** + * Creates a key store manager, backed by a key store on disk. + * + * @param filename the filename + * @param password the password + * + * @return the key store manager + */ + public static StudioKeyStoreManager createFileKeyStoreManager( String filename, String password ) + { + StudioKeyStoreManager manager = new StudioKeyStoreManager( Type.File, filename, password ); + manager.filename = filename; + manager.password = password; + return manager; + } + + + /** + * Creates a key store manager, backed by an in-memory key store. + * + * @return the key store manager + */ + public static StudioKeyStoreManager createMemoryKeyStoreManager() + { + StudioKeyStoreManager manager = new StudioKeyStoreManager( Type.Memory, null, null ); + return manager; + } + + + private StudioKeyStoreManager( Type type, String filename, String password ) + { + this.type = type; + this.filename = filename; + this.password = password; + } + + + /** + * Gets the underlying key store. + * + * @return the key store + */ + public synchronized KeyStore getKeyStore() throws CertificateException + { + if ( type == Type.File ) + { + return getFileKeyStore(); + } + else + { + return getMemoryKeyStore(); + } + } + + + /** + * Gets the memory key store. + * + * @return the memory key store + */ + private KeyStore getMemoryKeyStore() throws CertificateException + { + if ( memoryKeyStore == null ) + { + try + { + memoryKeyStore = KeyStore.getInstance( "JKS" ); //$NON-NLS-1$ + memoryKeyStore.load( null, null ); + } + catch ( Exception e ) + { + throw new CertificateException( Messages.StudioKeyStoreManager_CantReadTrustStore, e ); + } + } + return memoryKeyStore; + } + + + /** + * Loads the file key store. + * + * @return the file key store + */ + private KeyStore getFileKeyStore() throws CertificateException + { + try + { + KeyStore fileKeyStore = KeyStore.getInstance( "JKS" ); //$NON-NLS-1$ + File file = ConnectionCorePlugin.getDefault().getStateLocation().append( filename ).toFile(); + if ( file.exists() && file.isFile() && file.canRead() ) + { + fileKeyStore.load( new FileInputStream( file ), password.toCharArray() ); + } + else + { + fileKeyStore.load( null, null ); + } + + return fileKeyStore; + } + catch ( Exception e ) + { + throw new CertificateException( Messages.StudioKeyStoreManager_CantReadTrustStore, e ); + } + } + + + /** + * Adds the certificate to the key store. + * + * @param certificate the certificate + */ + public synchronized void addCertificate( X509Certificate certificate ) throws CertificateException + { + if ( type == Type.File ) + { + addToFileKeyStore( certificate ); + } + else + { + addToMemoryKeyStore( certificate ); + } + } + + + /** + * Adds the certificate to the memory key store. + * + * @param certificate the certificate + */ + private void addToMemoryKeyStore( X509Certificate certificate ) throws CertificateException + { + try + { + KeyStore memoryKeyStore = getMemoryKeyStore(); + addToKeyStore( certificate, memoryKeyStore ); + } + catch ( Exception e ) + { + throw new CertificateException( Messages.StudioKeyStoreManager_CantAddCertificateToTrustStore, e ); + } + } + + + /** + * Adds the certificate to the file key store. + * + * @param certificate the certificate + */ + private void addToFileKeyStore( X509Certificate certificate ) throws CertificateException + { + try + { + KeyStore fileKeyStore = getFileKeyStore(); + addToKeyStore( certificate, fileKeyStore ); + File file = ConnectionCorePlugin.getDefault().getStateLocation().append( filename ).toFile(); + fileKeyStore.store( new FileOutputStream( file ), password.toCharArray() ); + } + catch ( Exception e ) + { + throw new CertificateException( Messages.StudioKeyStoreManager_CantAddCertificateToTrustStore, e ); + } + } + + + private void addToKeyStore( X509Certificate certificate, KeyStore keyStore ) throws Exception + { + String alias = certificate.getSubjectX500Principal().getName(); + keyStore.setCertificateEntry( alias, certificate ); + } + + + /** + * Gets the certificates contained in the key store. + * + * @return the certificates + */ + public X509Certificate[] getCertificates() throws CertificateException + { + try + { + List certificateList = new ArrayList(); + KeyStore keyStore = getKeyStore(); + Enumeration aliases = keyStore.aliases(); + while ( aliases.hasMoreElements() ) + { + String alias = aliases.nextElement(); + Certificate certificate = keyStore.getCertificate( alias ); + if ( certificate instanceof X509Certificate ) + { + certificateList.add( ( X509Certificate ) certificate ); + } + } + return certificateList.toArray( new X509Certificate[0] ); + } + catch ( KeyStoreException e ) + { + throw new CertificateException( Messages.StudioKeyStoreManager_CantReadTrustStore, e ); + } + } + + + /** + * Removes the certificate from the key store. + * + * @param certificate the certificate + */ + public synchronized void removeCertificate( X509Certificate certificate ) throws CertificateException + { + if ( type == Type.File ) + { + removeFromFileKeyStore( certificate ); + } + else + { + removeFromMemoryKeyStore( certificate ); + } + } + + + /** + * Removes the certificate from the memory key store. + * + * @param certificate the certificate + */ + private void removeFromMemoryKeyStore( X509Certificate certificate ) throws CertificateException + { + try + { + KeyStore memoryKeyStore = getMemoryKeyStore(); + removeFromKeyStore( certificate, memoryKeyStore ); + } + catch ( Exception e ) + { + throw new CertificateException( Messages.StudioKeyStoreManager_CantRemoveCertificateFromTrustStore, e ); + } + } + + + /** + * Removes the certificate from the file key store. + * + * @param certificate the certificate + */ + private void removeFromFileKeyStore( X509Certificate certificate ) throws CertificateException + { + try + { + KeyStore fileKeyStore = getFileKeyStore(); + removeFromKeyStore( certificate, fileKeyStore ); + File file = ConnectionCorePlugin.getDefault().getStateLocation().append( filename ).toFile(); + fileKeyStore.store( new FileOutputStream( file ), password.toCharArray() ); + } + catch ( Exception e ) + { + e.printStackTrace(); + throw new CertificateException( Messages.StudioKeyStoreManager_CantRemoveCertificateFromTrustStore, e ); + } + } + + + private void removeFromKeyStore( X509Certificate certificate, KeyStore keyStore ) throws Exception + { + String alias = keyStore.getCertificateAlias( certificate ); + if ( alias != null ) + { + keyStore.deleteEntry( alias ); + } + } +} Propchange: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/StudioKeyStoreManager.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioTrustManager.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioTrustManager.java?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioTrustManager.java (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioTrustManager.java Wed May 27 16:51:29 2009 @@ -21,9 +21,6 @@ package org.apache.directory.studio.connection.core.io.jndi; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.security.KeyStore; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; @@ -47,8 +44,6 @@ */ class StudioTrustManager implements X509TrustManager { - private static final char[] PERMANENT_TRUST_STORE_PASSWORD = "changeit".toCharArray(); //$NON-NLS-1$ - private static final String PERMANENT_TRUST_STORE = "permanent.jks"; //$NON-NLS-1$ private X509TrustManager jvmTrustManager; @@ -96,19 +91,31 @@ } catch ( CertificateException e2 ) { - // ask for confirmation - ICertificateHandler ch = ConnectionCorePlugin.getDefault().getCertificateHandler(); - ICertificateHandler.TrustLevel trustLevel = ch.verifyTrustLevel( chain ); - switch ( trustLevel ) + try { - case Permanent: - addToPermanentTrustStore( chain ); - break; - case Session: - // TODO: put to session trust store??? - break; - case Not: - throw new CertificateException( Messages.error__untrusted_certificate, e1 ); + X509TrustManager sessionTrustManager = getSessionTrustManager(); + if ( sessionTrustManager == null ) + { + throw e2; + } + sessionTrustManager.checkServerTrusted( chain, authType ); + } + catch ( CertificateException e3 ) + { + // ask for confirmation + ICertificateHandler ch = ConnectionCorePlugin.getDefault().getCertificateHandler(); + ICertificateHandler.TrustLevel trustLevel = ch.verifyTrustLevel( chain ); + switch ( trustLevel ) + { + case Permanent: + ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().addCertificate( chain[0] ); + break; + case Session: + ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().addCertificate( chain[0] ); + break; + case Not: + throw new CertificateException( Messages.error__untrusted_certificate, e1 ); + } } } } @@ -127,83 +134,54 @@ /** * Gets the permanent trust manager, based on the permanent trust store. * - * @return the permanent trust manager + * @return the permanent trust manager, null if the trust store is empty * * @throws CertificateException the certificate exception */ private X509TrustManager getPermanentTrustManager() throws CertificateException { - KeyStore permanentKeyStore = loadPermanentTrustStore(); - try - { - Enumeration aliases = permanentKeyStore.aliases(); - if ( aliases.hasMoreElements() ) - { - TrustManagerFactory factory = TrustManagerFactory.getInstance( TrustManagerFactory - .getDefaultAlgorithm() ); - factory.init( permanentKeyStore ); - TrustManager[] permanentTrustManagers = factory.getTrustManagers(); - TrustManager permanentTrustManager = permanentTrustManagers[0]; - return ( X509TrustManager ) permanentTrustManager; - } - } - catch ( Exception e ) - { - throw new CertificateException( Messages.StudioTrustManager_CantCreatePermanentTrustManager, e ); - } - - return null; + KeyStore permanentTrustStore = ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getKeyStore(); + X509TrustManager permanentTrustManager = getTrustManager( permanentTrustStore ); + return permanentTrustManager; } /** - * Loads the permanent trust store. + * Gets the session trust manager, based on the session trust store. + * + * @return the session trust manager, null if the trust store is empty * - * @return the permanent trust store + * @throws CertificateException the certificate exception */ - private KeyStore loadPermanentTrustStore() throws CertificateException + private X509TrustManager getSessionTrustManager() throws CertificateException { - try - { - KeyStore permanentKeyStore = KeyStore.getInstance( "JKS" ); //$NON-NLS-1$ - File file = ConnectionCorePlugin.getDefault().getStateLocation().append( PERMANENT_TRUST_STORE ).toFile(); - if ( file.exists() && file.isFile() && file.canRead() ) - { - permanentKeyStore.load( new FileInputStream( file ), PERMANENT_TRUST_STORE_PASSWORD ); - } - else - { - permanentKeyStore.load( null, null ); - } - - return permanentKeyStore; - } - catch ( Exception e ) - { - throw new CertificateException( Messages.StudioTrustManager_CantLoadPermanentTrustStore, e ); - } + KeyStore sessionTrustStore = ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getKeyStore(); + X509TrustManager sessionTrustManager = getTrustManager( sessionTrustStore ); + return sessionTrustManager; } - /** - * Adds the certificate to the permanent trust store. - * - * @param chain the certificate chain - */ - private void addToPermanentTrustStore( X509Certificate[] chain ) throws CertificateException + private X509TrustManager getTrustManager( KeyStore trustStore ) throws CertificateException { try { - KeyStore permanentKeyStore = loadPermanentTrustStore(); - String alias = chain[0].getSubjectX500Principal().getName(); - permanentKeyStore.setCertificateEntry( alias, chain[0] ); - File file = ConnectionCorePlugin.getDefault().getStateLocation().append( PERMANENT_TRUST_STORE ).toFile(); - permanentKeyStore.store( new FileOutputStream( file ), PERMANENT_TRUST_STORE_PASSWORD ); + Enumeration aliases = trustStore.aliases(); + if ( aliases.hasMoreElements() ) + { + TrustManagerFactory factory = TrustManagerFactory.getInstance( TrustManagerFactory + .getDefaultAlgorithm() ); + factory.init( trustStore ); + TrustManager[] permanentTrustManagers = factory.getTrustManagers(); + TrustManager permanentTrustManager = permanentTrustManagers[0]; + return ( X509TrustManager ) permanentTrustManager; + } } catch ( Exception e ) { - throw new CertificateException( Messages.StudioTrustManager_CantAddCertificateToPermanentTrustStore, e ); + throw new CertificateException( Messages.StudioTrustManager_CantCreateTrustManager, e ); } + + return null; } } Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages.properties (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages.properties Wed May 27 16:51:29 2009 @@ -51,6 +51,8 @@ jobs__close_connections_error_1=Error while closing connection jobs__close_connections_error_n=Error while closing connections -StudioTrustManager_CantAddCertificateToPermanentTrustStore=Can't add certificate to permanent trust store. -StudioTrustManager_CantCreatePermanentTrustManager=Can't create permanent trust manager. -StudioTrustManager_CantLoadPermanentTrustStore=Can't load permanent trust store. +StudioTrustManager_CantCreateTrustManager=Can't create trust manager. + +StudioKeyStoreManager_CantReadTrustStore=Can't read certificates from key store. +StudioKeyStoreManager_CantAddCertificateToTrustStore=Can't add certificate to key store. +StudioKeyStoreManager_CantRemoveCertificateFromTrustStore=Can't remove certificate from key store. Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_de.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_de.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_de.properties (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_de.properties Wed May 27 16:51:29 2009 @@ -50,6 +50,8 @@ jobs__close_connections_error_1=Fehler beim Schliessen der Verbindung jobs__close_connections_error_n=Fehler beim Schliessen der Verbindungen -StudioTrustManager_CantAddCertificateToPermanentTrustStore=Fehler beim hinzuf\u00FCgen des Zertifikates zum Zertifikatsspeicher. -StudioTrustManager_CantCreatePermanentTrustManager=Fehler beim Erzeugen des Trust Managers. -StudioTrustManager_CantLoadPermanentTrustStore=Fehler beim Laden des Zertifikatsspeichers. \ No newline at end of file +StudioTrustManager_CantCreateTrustManager=Fehler beim Erzeugen des Trust Managers. + +StudioKeyStoreManager_CantReadTrustStore=Fehler beim Lesen der Zertifikate aus dem Zertifikatsspeicher. +StudioKeyStoreManager_CantAddCertificateToTrustStore=Fehler beim Hinzuf\u00FCgen des Zertifikates zum Zertifikatsspeicher. +StudioKeyStoreManager_CantRemoveCertificateFromTrustStore=Fehler beim L\u00FCschen des Zertifikates aus dem Zertifikatsspeicher. Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_fr.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_fr.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_fr.properties (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/messages_fr.properties Wed May 27 16:51:29 2009 @@ -1,4 +1,4 @@ -# Licensed to the Apache Software Foundation (ASF) under one +# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file @@ -51,6 +51,8 @@ jobs__close_connections_error_1=Une erreur est survenue lors de la fermeture de la connexion jobs__close_connections_error_n=Une erreur est survenue lors de la fermeture des connexions -StudioTrustManager_CantAddCertificateToPermanentTrustStore=Impossible d'ajouter le certificat au magasin de confiance permanent. -StudioTrustManager_CantCreatePermanentTrustManager=Impossible de cr\u00E9er le magasin de confiance permanent. -StudioTrustManager_CantLoadPermanentTrustStore=Impossible de charger le magasin de confiance permanent. \ No newline at end of file +StudioTrustManager_CantCreateTrustManager=Impossible de cr\u00E9er le magasin de confiance. + +StudioKeyStoreManager_CantReadTrustStore=Impossible de charger le magasin de confiance permanent. +StudioKeyStoreManager_CantAddCertificateToTrustStore=Impossible d'ajouter le certificat au magasin de confiance. +StudioKeyStoreManager_CantRemoveCertificateFromTrustStore=TODO:Can't remove certificate from key store. Modified: directory/studio/trunk/connection-ui/plugin.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/plugin.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/plugin.properties (original) +++ directory/studio/trunk/connection-ui/plugin.properties Wed May 27 16:51:29 2009 @@ -41,4 +41,10 @@ Cmd_Copy_id=org.apache.directory.studio.ldapbrowser.action.copy Cmd_Paste_id=org.apache.directory.studio.ldapbrowser.action.paste Cmd_Delete_id=org.apache.directory.studio.ldapbrowser.action.delete -Cmd_Properties_id=org.apache.directory.studio.ldapbrowser.action.properties \ No newline at end of file +Cmd_Properties_id=org.apache.directory.studio.ldapbrowser.action.properties + +PrefPage_MainPreferencePage_id=org.apache.directory.studio.ldapbrowser.preferences.MainPreferencePage +PrefPage_ConnectionsPreferencePage_id=org.apache.directory.studio.connection.preferences.ConnectionsPreferencePage +PrefPage_ConnectionsPreferencePage_name=Connections +PrefPage_CertificateValidationPreferencePage_id=org.apache.directory.studio.connection.preferences.CertificateValidationPreferencePage +PrefPage_CertificateValidationPreferencePage_name=Certificate Validation Modified: directory/studio/trunk/connection-ui/plugin.xml URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/plugin.xml?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/plugin.xml (original) +++ directory/studio/trunk/connection-ui/plugin.xml Wed May 27 16:51:29 2009 @@ -56,5 +56,20 @@ description="%ConnectionParameterPage_AuthenticationParameterPage_description" id="%ConnectionParameterPage_AuthenticationParameterPage_id" name="%ConnectionParameterPage_AuthenticationParameterPage_name"/> + + + + + + Modified: directory/studio/trunk/connection-ui/plugin_de.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/plugin_de.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/plugin_de.properties (original) +++ directory/studio/trunk/connection-ui/plugin_de.properties Wed May 27 16:51:29 2009 @@ -27,3 +27,5 @@ ConnectionParameterPage_AuthenticationParameterPage_name=Authentifizierung ConnectionParameterPage_AuthenticationParameterPage_description=Bitte w\u00E4hlen Sie eine Authentifizierungs-Methode und geben Sie ihre Anmeldedaten ein. +PrefPage_ConnectionsPreferencePage_name=Verbindungen +PrefPage_CertificateValidationPreferencePage_name=Zertifikatsvalidierung \ No newline at end of file Modified: directory/studio/trunk/connection-ui/plugin_fr.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/plugin_fr.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/plugin_fr.properties (original) +++ directory/studio/trunk/connection-ui/plugin_fr.properties Wed May 27 16:51:29 2009 @@ -26,3 +26,6 @@ ConnectionParameterPage_AuthenticationParameterPage_name=Authentification ConnectionParameterPage_AuthenticationParameterPage_description=Veuillez s\u00E9lectionner une m\u00E9thode d'authentification et renseigner les \u00E9l\u00E9ments d'authentification. + +PrefPage_ConnectionsPreferencePage_name=Connexions +PrefPage_CertificateValidationPreferencePage_name=TODO:Certificate Validation Modified: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/CertificateTrustDialog.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/CertificateTrustDialog.java?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/CertificateTrustDialog.java (original) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/CertificateTrustDialog.java Wed May 27 16:51:29 2009 @@ -141,13 +141,6 @@ { new CertificateInfoDialog( getShell(), certificateChain ).open(); } - - - @Override - public void widgetDefaultSelected( SelectionEvent e ) - { - new CertificateInfoDialog( getShell(), certificateChain ).open(); - } } ); trustNotButton = BaseWidgetUtils.createRadiobutton( composite, Messages Added: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java?rev=779237&view=auto ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java (added) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java Wed May 27 16:51:29 2009 @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.studio.connection.ui.preferences; + + +import org.apache.directory.studio.connection.core.ConnectionCoreConstants; +import org.apache.directory.studio.connection.core.ConnectionCorePlugin; +import org.apache.directory.studio.connection.ui.ConnectionUIPlugin; +import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils; +import org.apache.directory.studio.connection.ui.widgets.CertificateListComposite; +import org.eclipse.core.runtime.Preferences; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + + +/** + * The certificate validation preference page is used to manage trusted certificates. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class CertificateValidationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage +{ + + /** The verify certificates button. */ + private Button verifyCertificatesButton; + + /** The tab folder. */ + private TabFolder tabFolder; + + /** The composite containing permanent trusted certificates */ + private CertificateListComposite permanentCLComposite; + + /** The composite containing temporary trusted certificates */ + private CertificateListComposite sessionCLComposite; + + + /** + * + * Creates a new instance of MainPreferencePage. + */ + public CertificateValidationPreferencePage() + { + super( Messages.getString( "CertificateValidationPreferencePage.CertificateValidation" ) ); //$NON-NLS-1$ + super.setPreferenceStore( ConnectionUIPlugin.getDefault().getPreferenceStore() ); + //super.setDescription( Messages.getString( "SecurityPreferencePage.GeneralSettings" ) ); //$NON-NLS-1$ + } + + + /** + * {@inheritDoc} + */ + public void init( IWorkbench workbench ) + { + } + + + /** + * {@inheritDoc} + */ + protected Control createContents( Composite parent ) + { + Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 ); + + // enable/disable certificate validation + Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences(); + boolean validateCertificates = preferences + .getBoolean( ConnectionCoreConstants.PREFERENCE_VALIDATE_CERTIFICATES ); + verifyCertificatesButton = BaseWidgetUtils.createCheckbox( composite, Messages + .getString( "CertificateValidationPreferencePage.ValidateCertificates" ), 1 ); //$NON-NLS-1$ + verifyCertificatesButton.setSelection( validateCertificates ); + verifyCertificatesButton.addSelectionListener( new SelectionAdapter() + { + @Override + public void widgetSelected( SelectionEvent e ) + { + tabFolder.setEnabled( verifyCertificatesButton.getSelection() ); + } + } ); + + // certificate list widget + tabFolder = new TabFolder( composite, SWT.TOP ); + GridLayout mainLayout = new GridLayout(); + mainLayout.marginWidth = 0; + mainLayout.marginHeight = 0; + tabFolder.setLayout( mainLayout ); + tabFolder.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) ); + + permanentCLComposite = new CertificateListComposite( tabFolder, SWT.NONE ); + permanentCLComposite.setInput( ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager() ); + TabItem permanentTab = new TabItem( tabFolder, SWT.NONE, 0 ); + permanentTab.setText( Messages.getString( "CertificateValidationPreferencePage.PermanentTrusted" ) ); //$NON-NLS-1$ + permanentTab.setControl( permanentCLComposite ); + + sessionCLComposite = new CertificateListComposite( tabFolder, SWT.NONE ); + sessionCLComposite.setInput( ConnectionCorePlugin.getDefault().getSessionTrustStoreManager() ); + TabItem sessionTab = new TabItem( tabFolder, SWT.NONE, 1 ); + sessionTab.setText( Messages.getString( "CertificateValidationPreferencePage.TemporaryTrusted" ) ); //$NON-NLS-1$ + sessionTab.setControl( sessionCLComposite ); + + tabFolder.setEnabled( verifyCertificatesButton.getSelection() ); + return composite; + } + + + /** + * {@inheritDoc} + */ + protected void performDefaults() + { + verifyCertificatesButton.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences() + .getDefaultBoolean( ConnectionCoreConstants.PREFERENCE_VALIDATE_CERTIFICATES ) ); + super.performDefaults(); + } + + + /** + * {@inheritDoc} + */ + public boolean performOk() + { + ConnectionCorePlugin.getDefault().getPluginPreferences().setValue( + ConnectionCoreConstants.PREFERENCE_VALIDATE_CERTIFICATES, verifyCertificatesButton.getSelection() ); + return true; + } + +} Propchange: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/CertificateValidationPreferencePage.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java?rev=779237&view=auto ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java (added) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java Wed May 27 16:51:29 2009 @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.studio.connection.ui.preferences; + + +import org.apache.directory.studio.connection.core.ConnectionCoreConstants; +import org.apache.directory.studio.connection.core.ConnectionCorePlugin; +import org.apache.directory.studio.connection.ui.ConnectionUIPlugin; +import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils; +import org.eclipse.core.runtime.Preferences; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + + +/** + * The connections preference page contains general settings for LDAP connections. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class ConnectionsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage +{ + + private Text jndiLdapContextProvider; + + + /** + * Creates a new instance of ConnectionsPreferencePage. + */ + public ConnectionsPreferencePage() + { + super( Messages.getString( "ConnectionsPreferencePage.Connections" ) ); //$NON-NLS-1$ + super.setPreferenceStore( ConnectionUIPlugin.getDefault().getPreferenceStore() ); + super.setDescription( Messages.getString( "ConnectionsPreferencePage.GeneralSettings" ) ); //$NON-NLS-1$ + } + + + /** + * {@inheritDoc} + */ + public void init( IWorkbench workbench ) + { + } + + + /** + * {@inheritDoc} + */ + protected Control createContents( Composite parent ) + { + Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 ); + + BaseWidgetUtils.createSpacer( composite, 1 ); + BaseWidgetUtils.createSpacer( composite, 1 ); + + Group group = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite, 1, 1 ), Messages + .getString( "ConnectionsPreferencePage.ContextProvider" ), 1 ); //$NON-NLS-1$ + + Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences(); + String ldapCtxFactory = preferences.getString( ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY ); + String defaultLdapCtxFactory = preferences + .getDefaultString( ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY ); + String note = NLS.bind( + Messages.getString( "ConnectionsPreferencePage.SystemDetectedContextFactory" ), defaultLdapCtxFactory ); //$NON-NLS-1$ + + jndiLdapContextProvider = BaseWidgetUtils.createText( group, ldapCtxFactory, 1 ); + BaseWidgetUtils.createWrappedLabel( group, note, 1 ); + + return composite; + } + + + /** + * {@inheritDoc} + */ + protected void performDefaults() + { + jndiLdapContextProvider.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getDefaultString( + ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY ) ); + super.performDefaults(); + } + + + /** + * {@inheritDoc} + */ + public boolean performOk() + { + ConnectionCorePlugin.getDefault().getPluginPreferences().setValue( + ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY, jndiLdapContextProvider.getText() ); + return true; + } + +} Propchange: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/ConnectionsPreferencePage.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/Messages.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/Messages.java?rev=779237&view=auto ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/Messages.java (added) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/Messages.java Wed May 27 16:51:29 2009 @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.studio.connection.ui.preferences; + + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + + +public class Messages +{ + private static final String BUNDLE_NAME = "org.apache.directory.studio.connection.ui.preferences.messages"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); + + + private Messages() + { + } + + + public static String getString( String key ) + { + try + { + return RESOURCE_BUNDLE.getString( key ); + } + catch ( MissingResourceException e ) + { + return '!' + key + '!'; + } + } +} Propchange: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/Messages.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages.properties?rev=779237&view=auto ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages.properties (added) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages.properties Wed May 27 16:51:29 2009 @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +ConnectionsPreferencePage.Connections=Connections +ConnectionsPreferencePage.GeneralSettings=General settings for LDAP connections: +ConnectionsPreferencePage.ContextProvider=JNDI LDAP context provider +ConnectionsPreferencePage.SystemDetectedContextFactory=Note: The system detected ''{0}''. + +CertificateValidationPreferencePage.CertificateValidation=Certificate Validation +CertificateValidationPreferencePage.ValidateCertificates=Validate certificates for secure LDAP connections +CertificateValidationPreferencePage.PermanentTrusted=Permanent Trusted +CertificateValidationPreferencePage.TemporaryTrusted=Temporary Trusted \ No newline at end of file Propchange: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages.properties ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_de.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_de.properties?rev=779237&view=auto ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_de.properties (added) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_de.properties Wed May 27 16:51:29 2009 @@ -0,0 +1,27 @@ +#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +CertificateValidationPreferencePage.CertificateValidation = Zertifikatsvalidierung +CertificateValidationPreferencePage.PermanentTrusted = Dauerhaft vertrauensw\u00FCrdig +CertificateValidationPreferencePage.TemporaryTrusted = Vor\u00FCbergehend vertrauensw\u00FCrdig +CertificateValidationPreferencePage.ValidateCertificates = Zertifikate f\u00FCr sichere LDAP Verbindungen validieren + +ConnectionsPreferencePage.Connections = Verbindungen +ConnectionsPreferencePage.ContextProvider = JNDI LDAP Context Provider +ConnectionsPreferencePage.GeneralSettings = Allgemeine Einstellungen f\u00FCr LDAP Verbindungen: +ConnectionsPreferencePage.SystemDetectedContextFactory = Hinweis: Das System hat ''{0}'' ermittelt. Propchange: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_de.properties ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_fr.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_fr.properties?rev=779237&view=auto ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_fr.properties (added) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_fr.properties Wed May 27 16:51:29 2009 @@ -0,0 +1,27 @@ +#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +CertificateValidationPreferencePage.CertificateValidation = TODO:Certificate Validation +CertificateValidationPreferencePage.PermanentTrusted = TODO:Permanent Trusted +CertificateValidationPreferencePage.TemporaryTrusted = TODO:Temporary Trusted +CertificateValidationPreferencePage.ValidateCertificates = Valider les certificats des connexions LDAP s\u00E9curis\u00E9es + +ConnectionsPreferencePage.Connections = Connexions +ConnectionsPreferencePage.ContextProvider = Fournisseur de contexte JNDI LDAP +ConnectionsPreferencePage.GeneralSettings = R\u00E9glages g\u00E9n\u00E9raux pour les connexions LDAP: +ConnectionsPreferencePage.SystemDetectedContextFactory = Note: Le syst\u00E8me a d\u00E9tect\u00E9 ''{0}''. Propchange: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/messages_fr.properties ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java (original) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java Wed May 27 16:51:29 2009 @@ -248,7 +248,6 @@ { public void selectionChanged( SelectionChangedEvent event ) { - event.getSelection(); populateCertificateTree(); } } ); Added: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java?rev=779237&view=auto ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java (added) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java Wed May 27 16:51:29 2009 @@ -0,0 +1,222 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.studio.connection.ui.widgets; + + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Iterator; + +import org.apache.directory.studio.connection.core.StudioKeyStoreManager; +import org.apache.directory.studio.connection.ui.dialogs.CertificateInfoDialog; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; + + +/** + * This composite displays a list of certificates and buttons + * to add, delete and view certificates. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class CertificateListComposite extends Composite +{ + + private StudioKeyStoreManager keyStoreManager; + private Composite container; + private TableViewer tableViewer; + private Button viewButton; + private Button addButton; + private Button removeButton; + + + /** + * Creates a new instance of CertificateInfoComposite. + * + * @param parent + * @param style + */ + public CertificateListComposite( Composite parent, int style ) + { + super( parent, style ); + GridLayout layout = new GridLayout( 1, false ); + layout.marginWidth = 0; + layout.marginHeight = 0; + setLayout( layout ); + setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) ); + + container = new Composite( this, SWT.NONE ); + layout = new GridLayout( 2, false ); + container.setLayout( layout ); + container.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) ); + + createTreeViewer(); + createButtons(); + } + + + private void createTreeViewer() + { + tableViewer = new TableViewer( container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER ); + tableViewer.getTable().setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) ); + tableViewer.setContentProvider( new KeyStoreContentProvider() ); + tableViewer.setLabelProvider( new KeyStoreLabelProvider() ); + tableViewer.addSelectionChangedListener( new ISelectionChangedListener() + { + public void selectionChanged( SelectionChangedEvent event ) + { + viewButton.setEnabled( !event.getSelection().isEmpty() ); + removeButton.setEnabled( !event.getSelection().isEmpty() ); + } + } ); + } + + + private void createButtons() + { + Composite buttonContainer = BaseWidgetUtils.createColumnContainer( container, 1, 1 ); + buttonContainer.setLayoutData( new GridData( GridData.FILL, GridData.FILL, false, false ) ); + viewButton = BaseWidgetUtils.createButton( buttonContainer, Messages + .getString( "CertificateListComposite.ViewButton" ), 1 );//$NON-NLS-1$ + viewButton.setEnabled( false ); + viewButton.addSelectionListener( new SelectionAdapter() + { + @Override + public void widgetSelected( SelectionEvent e ) + { + IStructuredSelection selection = ( IStructuredSelection ) tableViewer.getSelection(); + X509Certificate certificate = ( X509Certificate ) selection.getFirstElement(); + new CertificateInfoDialog( getShell(), new X509Certificate[] + { certificate } ).open(); + } + } ); + + addButton = BaseWidgetUtils.createButton( buttonContainer, Messages + .getString( "CertificateListComposite.AddButton" ), 1 ); //$NON-NLS-1$ + addButton.setEnabled( false ); + // TODO: implement add action + + removeButton = BaseWidgetUtils.createButton( buttonContainer, Messages + .getString( "CertificateListComposite.RemoveButton" ), 1 ); //$NON-NLS-1$ + removeButton.setEnabled( false ); + removeButton.addSelectionListener( new SelectionAdapter() + { + @Override + public void widgetSelected( SelectionEvent e ) + { + IStructuredSelection selection = ( IStructuredSelection ) tableViewer.getSelection(); + Iterator iterator = selection.iterator(); + while ( iterator.hasNext() ) + { + X509Certificate certificate = iterator.next(); + try + { + keyStoreManager.removeCertificate( certificate ); + } + catch ( CertificateException ce ) + { + throw new RuntimeException( ce ); + } + } + tableViewer.refresh(); + } + } ); + } + + + /** + * Sets the input for this composite. + * + * @param keyStoreManager the key store manager + */ + public void setInput( StudioKeyStoreManager keyStoreManager ) + { + this.keyStoreManager = keyStoreManager; + tableViewer.setInput( keyStoreManager ); + } + + class KeyStoreContentProvider implements IStructuredContentProvider + { + + /** + * {@inheritDoc} + */ + public Object[] getElements( Object inputElement ) + { + if ( inputElement instanceof StudioKeyStoreManager ) + { + StudioKeyStoreManager keyStoreManager = ( StudioKeyStoreManager ) inputElement; + try + { + return keyStoreManager.getCertificates(); + } + catch ( CertificateException e ) + { + throw new RuntimeException( e ); + } + } + return null; + } + + + /** + * {@inheritDoc} + */ + public void dispose() + { + } + + + /** + * {@inheritDoc} + */ + public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) + { + } + + } + + class KeyStoreLabelProvider extends LabelProvider + { + @Override + public String getText( Object element ) + { + if ( element instanceof X509Certificate ) + { + X509Certificate certificate = ( X509Certificate ) element; + return certificate.getSubjectX500Principal().getName(); + } + return super.getText( element ); + } + } +} Propchange: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateListComposite.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages.properties (original) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages.properties Wed May 27 16:51:29 2009 @@ -70,6 +70,10 @@ CertificateInfoComposite.ValidityLabel = Validity CertificateInfoComposite.Version = Version +CertificateListComposite.AddButton = Add... +CertificateListComposite.RemoveButton = Remove +CertificateListComposite.ViewButton = View... + NetworkParameterPage.CheckNetworkParameter = Check Network Parameter NetworkParameterPage.ConnectionEstablished = The connection was established successfully. NetworkParameterPage.ConnectionExists = A connection named "{0}" already exists. Modified: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_de.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_de.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_de.properties (original) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_de.properties Wed May 27 16:51:29 2009 @@ -69,6 +69,10 @@ CertificateInfoComposite.ValidityLabel = G\u00FCltigkeit CertificateInfoComposite.Version = Version +CertificateListComposite.AddButton = Hinzuf\u00FCgen... +CertificateListComposite.RemoveButton = Entfernen +CertificateListComposite.ViewButton = Anzeigen... + NetworkParameterPage.CheckNetworkParameter = Netzwerkparameter \u00FCberpr\u00FCfen NetworkParameterPage.ConnectionEstablished = Die Verbindung wurde erfolgreich aufgebaut. NetworkParameterPage.ConnectionExists = Eine Verbindung mit dem Namen "{0}" existiert bereits. Modified: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_fr.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_fr.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_fr.properties (original) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/messages_fr.properties Wed May 27 16:51:29 2009 @@ -1,4 +1,4 @@ -#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) +#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -68,6 +68,10 @@ CertificateInfoComposite.ValidityLabel = Validit\u00E9 CertificateInfoComposite.Version = Version +CertificateListComposite.AddButton = Ajouter... +CertificateListComposite.RemoveButton = Supprimer +CertificateListComposite.ViewButton = Afficher... + NetworkParameterPage.CheckNetworkParameter = V\u00E9rifier les param\u00E8tres r\u00E9seau NetworkParameterPage.ConnectionEstablished = La connexion a \u00E9t\u00E9 \u00E9tablie avec succ\u00E8s NetworkParameterPage.ConnectionExists = Le nom "{0}" correspond \u00E0 une connexion existante. Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/MainPreferencePage.java Wed May 27 16:51:29 2009 @@ -21,18 +21,11 @@ package org.apache.directory.studio.ldapbrowser.common.dialogs.preferences; -import org.apache.directory.studio.connection.core.ConnectionCoreConstants; -import org.apache.directory.studio.connection.core.ConnectionCorePlugin; import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils; import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator; -import org.eclipse.core.runtime.Preferences; import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; @@ -46,11 +39,6 @@ public class MainPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - private Text jndiLdapContextProvider; - - private Button verifyCertificatesButton; - - /** * * Creates a new instance of MainPreferencePage. @@ -81,25 +69,6 @@ BaseWidgetUtils.createSpacer( composite, 1 ); BaseWidgetUtils.createSpacer( composite, 1 ); - Group group = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite, 1, 1 ), Messages - .getString( "MainPreferencePage.ContextProvider" ), 1 ); //$NON-NLS-1$ - - Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences(); - String ldapCtxFactory = preferences.getString( ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY ); - String defaultLdapCtxFactory = preferences - .getDefaultString( ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY ); - String note = NLS.bind( - Messages.getString( "MainPreferencePage.SystemDetectedContextFactory" ), defaultLdapCtxFactory ); //$NON-NLS-1$ - - jndiLdapContextProvider = BaseWidgetUtils.createText( group, ldapCtxFactory, 1 ); - BaseWidgetUtils.createWrappedLabel( group, note, 1 ); - - boolean validateCertificates = preferences - .getBoolean( ConnectionCoreConstants.PREFERENCE_VALIDATE_CERTIFICATES ); - verifyCertificatesButton = BaseWidgetUtils.createCheckbox( composite, Messages - .getString( "MainPreferencePage.ValidateCertificates" ), 1 ); //$NON-NLS-1$ - verifyCertificatesButton.setSelection( validateCertificates ); - return composite; } @@ -109,10 +78,6 @@ */ protected void performDefaults() { - jndiLdapContextProvider.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getDefaultString( - ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY ) ); - verifyCertificatesButton.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences() - .getDefaultBoolean( ConnectionCoreConstants.PREFERENCE_VALIDATE_CERTIFICATES ) ); super.performDefaults(); } @@ -122,10 +87,6 @@ */ public boolean performOk() { - ConnectionCorePlugin.getDefault().getPluginPreferences().setValue( - ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY, jndiLdapContextProvider.getText() ); - ConnectionCorePlugin.getDefault().getPluginPreferences().setValue( - ConnectionCoreConstants.PREFERENCE_VALIDATE_CERTIFICATES, verifyCertificatesButton.getSelection() ); return true; } Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages.properties Wed May 27 16:51:29 2009 @@ -77,11 +77,8 @@ EntryEditorPreferencePage.ShowObjectClassAttributes=Show objectClass attribute EntryEditorPreferencePage.ShowOperationalAttributes=Show operational attributes EntryEditorPreferencePage.VisibleAttributes=Visible Attributes -MainPreferencePage.ContextProvider=JNDI LDAP context provider MainPreferencePage.GeneralSettings=General settings for the LDAP browser: MainPreferencePage.LDAP=LDAP -MainPreferencePage.SystemDetectedContextFactory=Note: The system detected ''{0}''. -MainPreferencePage.ValidateCertificates=Validate certificates for secure LDAP connections SyntaxDialog.SelectSyntaxOID=Select Syntax OID SyntaxDialog.SyntaxOID=Syntax OID: SyntaxValueEditorDialog.AttributeValueEditor=Attribute Value Editor Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_de.properties Wed May 27 16:51:29 2009 @@ -77,11 +77,8 @@ EntryEditorPreferencePage.ShowObjectClassAttributes=Objektklassen anzeigen EntryEditorPreferencePage.ShowOperationalAttributes=Operationale Attribute anzeigen EntryEditorPreferencePage.VisibleAttributes=Sichtbare Attribute -MainPreferencePage.ContextProvider=JNDI LDAP Context Provider MainPreferencePage.GeneralSettings=Allgemeine Einstellungen f\u00FCr den LDAP Browser: MainPreferencePage.LDAP=LDAP -MainPreferencePage.SystemDetectedContextFactory=Hinweis: Das System hat ''{0}'' ermittelt. -MainPreferencePage.ValidateCertificates=Zertifikate für sichere LDAP Verbindungen validieren SyntaxDialog.SelectSyntaxOID=Syntax OID ausw\u00E4hlen SyntaxDialog.SyntaxOID=Syntax OID: SyntaxValueEditorDialog.AttributeValueEditor=Attribut Wert Editor Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties?rev=779237&r1=779236&r2=779237&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/preferences/messages_fr.properties Wed May 27 16:51:29 2009 @@ -77,11 +77,8 @@ EntryEditorPreferencePage.ShowObjectClassAttributes=Afficher l'attribut objectClass EntryEditorPreferencePage.ShowOperationalAttributes=Afficher les attributs op\u00E9rationnels EntryEditorPreferencePage.VisibleAttributes=Attributs visibles -MainPreferencePage.ContextProvider=Fournisseur de contexte JNDI LDAP MainPreferencePage.GeneralSettings=R\u00E9glages g\u00E9n\u00E9raux pour le navigateur LDAP: MainPreferencePage.LDAP=LDAP -MainPreferencePage.SystemDetectedContextFactory=Note: Le syst\u00E8me a d\u00E9tect\u00E9 ''{0}''. -MainPreferencePage.ValidateCertificates=Valider les certificats des connexions LDAP s\u00E9curis\u00E9es SyntaxDialog.SelectSyntaxOID=S\u00E9lectionner l'OID de la syntaxe SyntaxDialog.SyntaxOID=OID de la syntaxe: SyntaxValueEditorDialog.AttributeValueEditor=Attribut d'\u00E9diteur de valeur