public final class LDAPConnectionConsoleInteraction extends Object
Constructor and Description |
---|
LDAPConnectionConsoleInteraction(com.forgerock.opendj.cli.Tool tool,
SecureConnectionCliArgs secureArgs)
Constructs a new console interaction.
|
LDAPConnectionConsoleInteraction(com.forgerock.opendj.cli.Tool tool,
SecureConnectionCliArgs secureArgs,
boolean allowAnonymousIfNonInteractive)
Constructs a new console interaction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkServerCertificate(X509Certificate[] chain,
Exception reason)
Indicate if the certificate chain can be trusted.
|
String |
getAdministratorUID()
Gets the administrator UID name that should be used for connections based on this interaction.
|
Dn |
getBindDN()
Gets the bind DN name that should be used for connections based on this interaction.
|
String |
getBindPassword()
Gets the bind password that should be used for connections based on this interaction.
|
com.forgerock.opendj.cli.CommandBuilder |
getCommandBuilder()
Returns the command builder with the equivalent arguments on the non-interactive mode.
|
int |
getConnectTimeout()
Returns the timeout to be used to connect with the server.
|
String |
getHostName()
Gets the host name that should be used for connections based on this interaction.
|
HostPort |
getHostPort()
Returns the host port that should be used for connections based on this interaction.
|
KeyManager |
getKeyManager()
Gets the key manager that should be used for connections based on this interaction.
|
KeyStore |
getKeyStore()
Gets the key store that should be used for connections based on this interaction.
|
int |
getPortNumber()
Gets the port number name that should be used for connections based on this interaction.
|
String |
getProvidedAdminUID()
Returns the explicitly provided Admin UID from the user (interactively or through the argument).
|
Dn |
getProvidedBindDN()
Returns the explicitly provided bind DN from the user (interactively or through the argument).
|
ApplicationTrustManager |
getTrustManager()
Gets the trust manager that should be used for connections based on this interaction.
|
void |
initializeGlobalArguments(String hostName,
int port,
String adminUid,
Dn bindDn,
String bindPwd,
LinkedHashMap<String,String> pwdFile)
Initializes the global arguments in the parser with the provided values.
|
boolean |
isTrustAll()
Indicate if all certificates must be accepted.
|
boolean |
promptForCertificateConfirmation(ApplicationTrustManager trustManager,
HostPort hostPort,
LocalizedLogger logger)
Prompts the user to accept the certificate.
|
void |
resetConnectionArguments()
Resets the connection parameters for the LDAPConsoleInteraction object.
|
void |
resetHeadingDisplayed()
Resets the heading displayed flag, so that next time we call run the heading is displayed.
|
void |
run()
Interact with the user though the console to get information necessary to establish an LDAP connection.
|
void |
run(boolean canUseStartTLS)
Interact with the user though the console to get information necessary to establish an LDAP connection.
|
void |
setDisplayLdapIfSecureParameters(boolean displayLdapIfSecureParameters)
Tells whether we propose LDAP as protocol even if the user provided security parameters.
|
void |
setHeadingMessage(LocalizableMessage heading)
Sets the heading that is displayed in interactive mode.
|
void |
setPortNumber(int portNumber)
Sets the port number name that should be used for connections based on this interaction.
|
void |
setUseAdminOrBindDn(boolean useAdminOrBindDn)
Tells whether we can ask during interaction for both the DN and the admin UID or not.
|
boolean |
useSSL()
Indicates whether a connection should use SSL based on this interaction.
|
boolean |
useStartTLS()
Indicates whether a connection should use StartTLS based on this interaction.
|
public LDAPConnectionConsoleInteraction(com.forgerock.opendj.cli.Tool tool, SecureConnectionCliArgs secureArgs)
tool
- toolsecureArgs
- existing set of arguments that have already been parsed and contain some potential command line
specified LDAP argumentspublic LDAPConnectionConsoleInteraction(com.forgerock.opendj.cli.Tool tool, SecureConnectionCliArgs secureArgs, boolean allowAnonymousIfNonInteractive)
tool
- toolsecureArgs
- existing set of arguments that have already been parsed and contain some potential command line
specified LDAP argumentsallowAnonymousIfNonInteractive
- If this console interaction should allow anonymous user in non interactive mode.
If tool is interactive, the user will always be prompted for credentials.public void run() throws com.forgerock.opendj.cli.ArgumentException
com.forgerock.opendj.cli.ArgumentException
- if there is a problem with the argumentspublic void run(boolean canUseStartTLS) throws com.forgerock.opendj.cli.ArgumentException
canUseStartTLS
- whether we can propose to connect using Start TLS or not.com.forgerock.opendj.cli.ArgumentException
- if there is a problem with the argumentspublic boolean useSSL()
public boolean useStartTLS()
public String getHostName()
public int getPortNumber()
public HostPort getHostPort()
public void setPortNumber(int portNumber)
portNumber
- port number for connectionspublic Dn getBindDN()
public String getAdministratorUID()
public String getBindPassword()
public ApplicationTrustManager getTrustManager()
public KeyStore getKeyStore()
public KeyManager getKeyManager()
public boolean isTrustAll()
public int getConnectTimeout()
public boolean checkServerCertificate(X509Certificate[] chain, Exception reason)
chain
- The certificate chain to validatereason
- The reason why the chain has been rejected.public boolean promptForCertificateConfirmation(ApplicationTrustManager trustManager, HostPort hostPort, LocalizedLogger logger)
trustManager
- the trustManager used when trying to establish the connection.hostPort
- the HostPort used to connect to the server.logger
- the Logger used to log messages.true
if the user accepted the certificate and false
otherwise.public void setHeadingMessage(LocalizableMessage heading)
heading
- the heading that is displayed in interactive mode.public com.forgerock.opendj.cli.CommandBuilder getCommandBuilder()
public void setUseAdminOrBindDn(boolean useAdminOrBindDn)
false
.useAdminOrBindDn
- whether we can ask for both the DN and the admin UID during interaction or not.public void setDisplayLdapIfSecureParameters(boolean displayLdapIfSecureParameters)
displayLdapIfSecureParameters
- whether propose LDAP as protocol even if the user provided security parameters or not.public void resetHeadingDisplayed()
public void initializeGlobalArguments(String hostName, int port, String adminUid, Dn bindDn, String bindPwd, LinkedHashMap<String,String> pwdFile)
hostName
- the host name.port
- the port to connect to the server.adminUid
- the administrator UID.bindDn
- the bind DN to bind to the server.bindPwd
- the password to bind.pwdFile
- the Map containing the file and the password to bind.public void resetConnectionArguments()
public String getProvidedAdminUID()
public Dn getProvidedBindDN()
Copyright 2010-2018 ForgeRock AS.