| | |
| | | // Indicate if the truststore in in memory |
| | | private boolean trustStoreInMemory = false; |
| | | |
| | | // Indicate if the all certificates are accepted |
| | | private boolean trustAll = false; |
| | | |
| | | // Indicate that the trust manager was created with the parameters provided |
| | | private boolean trustManagerInitialized; |
| | | |
| | |
| | | this.app = app; |
| | | this.secureArgsList = secureArgs; |
| | | this.commandBuilder = new CommandBuilder(null); |
| | | this.useSSL = secureArgs.useSSL(); |
| | | this.useStartTLS = secureArgs.useStartTLS(); |
| | | this.trustAll = secureArgs.trustAllArg.isPresent(); |
| | | copySecureArgsList = new SecureConnectionCliArgs(secureArgs.alwaysSSL()); |
| | | try |
| | | { |
| | |
| | | || |
| | | secureArgsList.keyStorePasswordFileArg.isPresent() |
| | | ); |
| | | |
| | | // Get the LDAP host. |
| | | hostName = secureArgsList.hostNameArg.getValue(); |
| | | final String tmpHostName = hostName; |
| | |
| | | useStartTLS = secureArgsList.useStartTLS(); |
| | | boolean connectionTypeIsSet = |
| | | ( |
| | | secureArgsList.alwaysSSL() |
| | | || |
| | | secureArgsList.useSSLArg.isPresent() |
| | | || |
| | | secureArgsList.useStartTLSArg.isPresent() |
| | |
| | | ); |
| | | boolean askForTrustStore = false; |
| | | |
| | | trustAll = secureArgsList.trustAllArg.isPresent(); |
| | | |
| | | // Try to use the local instance trustore, to avoid certifacte validation |
| | | // when both the CLI and the server are in the same instance. |
| | | if (weDontKnowTheTrustMethod) { |
| | |
| | | if (result.getValue().equals(TrustMethod.TRUSTALL.getChoice())) |
| | | { |
| | | commandBuilder.addArgument(copySecureArgsList.trustAllArg); |
| | | trustAll = true; |
| | | // If we have the trustALL flag, don't do anything |
| | | // just return null |
| | | return null; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Indicate if all certificates must be accepted. |
| | | * |
| | | * @return true all certificates must be accepted. |
| | | */ |
| | | public boolean isTrustAll() { |
| | | return this.trustAll; |
| | | } |
| | | |
| | | /** |
| | | * Indicate if the certificate chain can be trusted. |
| | | * |
| | | * @param chain The certificate chain to validate |