protected LdapNetworkConnection openLdapConnection(LdapSettings ldapSettings) throws LdapException { final LdapConnectionConfig config = new LdapConnectionConfig(); config.setLdapHost(ldapSettings.getUri().getHost()); config.setLdapPort(ldapSettings.getUri().getPort()); config.setUseSsl(ldapSettings.getUri().getScheme().startsWith("ldaps")); config.setUseTls(ldapSettings.isUseStartTls()); if (ldapSettings.isTrustAllCertificates()) { config.setTrustManagers(new TrustAllX509TrustManager()); } config.setName(ldapSettings.getSystemUserName()); config.setCredentials(ldapSettings.getSystemPassword()); return ldapConnector.connect(config); }
config.setTrustManagers(new TrustAllX509TrustManager());
config.setTrustManagers(new TrustAllX509TrustManager());
/** * Create a new instance of a LdapConnection on a given * server, and a give port. This SSL connection will use the provided * TrustManagers * * @param server The server we want to be connected to. If null or empty, * we will default to LocalHost. * @param port The port the server is listening to * @param trustManagers The TrustManager to use */ public LdapNetworkConnection( String server, int port, TrustManager... trustManagers ) { this( buildConfig( server, port, true ) ); config.setTrustManagers( trustManagers ); }
/** * Create a new instance of a LdapConnection on a given * server, and a give port. This SSL connection will use the provided * TrustManagers * * @param server The server we want to be connected to. If null or empty, * we will default to LocalHost. * @param port The port the server is listening to * @param trustManagers The TrustManager to use */ public LdapNetworkConnection( String server, int port, TrustManager... trustManagers ) { this( buildConfig( server, port, true ) ); config.setTrustManagers( trustManagers ); }
/** * Create a new instance of a LdapConnection on a given * server, and a give port. This SSL connection will use the provided * TrustManagers * * @param server The server we want to be connected to. If null or empty, * we will default to LocalHost. * @param port The port the server is listening to * @param trustManagers The TrustManager to use */ public LdapNetworkConnection( String server, int port, TrustManager... trustManagers ) { this( buildConfig( server, port, true ) ); config.setTrustManagers( trustManagers ); }
protected LdapNetworkConnection openLdapConnection(LdapSettings ldapSettings) throws LdapException { final LdapConnectionConfig config = new LdapConnectionConfig(); config.setLdapHost(ldapSettings.getUri().getHost()); config.setLdapPort(ldapSettings.getUri().getPort()); config.setUseSsl(ldapSettings.getUri().getScheme().startsWith("ldaps")); config.setUseTls(ldapSettings.isUseStartTls()); if (ldapSettings.isTrustAllCertificates()) { config.setTrustManagers(new TrustAllX509TrustManager()); } config.setName(ldapSettings.getSystemUserName()); config.setCredentials(ldapSettings.getSystemPassword()); return ldapConnector.connect(config); }
config.setTrustManagers(tmf.getTrustManagers());
config.setTrustManagers(new TrustAllX509TrustManager());
config.setTrustManagers(new TrustAllX509TrustManager());
/** * Creates a new connection config based on the config. * @return the connection config. */ @NotNull private LdapConnectionConfig createConnectionConfig() { LdapConnectionConfig cc = new LdapConnectionConfig(); cc.setLdapHost(config.getHostname()); cc.setLdapPort(config.getPort()); cc.setUseSsl(config.useSSL()); cc.setUseTls(config.useTLS()); // todo: implement better trustmanager/keystore management (via sling/felix) if (config.noCertCheck()) { cc.setTrustManagers(new NoVerificationTrustManager()); } if (enabledSSLProtocols != null) { cc.setEnabledProtocols(enabledSSLProtocols); } return cc; }
ldapConnectionConfig.setTrustManagers( trustManagers );
lcc.setTrustManagers(trustManagers); lcc.setKeyManagers(keyManagers); if (cc.getSslConfig() != null && cc.getSslConfig().getEnabledCipherSuites() != null) {
lcc.setTrustManagers(tmf.getTrustManagers());
connection.getConfig().setTrustManagers( config.getTrustManager() ); connection.getConfig().setUseTls( true );
config.setTrustManagers( new LdapClientTrustStoreManager( Config.getInstance().getProperty( GlobalIds .TRUST_STORE ), Config.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ).toCharArray(), null, true ) ); logConfig.setTrustManagers( new LdapClientTrustStoreManager( Config.getInstance().getProperty( GlobalIds.TRUST_STORE ), Config.getInstance().getProperty( GlobalIds.TRUST_STORE_PW, true ).toCharArray (), null, true ) );
connectionConfig.setLdapHost( delegateHost ); connectionConfig.setLdapPort( delegatePort ); connectionConfig.setTrustManagers( new NoVerificationTrustManager() ); connectionConfig.setUseSsl( true ); connectionConfig.setLdapPort( delegatePort ); connectionConfig.setTrustManagers( new NoVerificationTrustManager() );