public class LDAPConnectionConsoleInteraction extends Object
Constructor and Description |
---|
LDAPConnectionConsoleInteraction(com.forgerock.opendj.cli.ConsoleApplication app,
SecureConnectionCliArgs secureArgs)
Constructs a new console interaction.
|
LDAPConnectionConsoleInteraction(com.forgerock.opendj.cli.ConsoleApplication app,
SecureConnectionCliArgs secureArgs,
boolean allowAnonymousIfNonInteractive)
Constructs a new console interaction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkServerCertificate(X509Certificate[] chain,
String authType,
String host)
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.
|
org.forgerock.opendj.ldap.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.
|
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).
|
org.forgerock.opendj.ldap.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,
org.forgerock.opendj.ldap.Dn bindDn,
String bindPwd,
LinkedHashMap<String,String> pwdFile)
Initializes the global arguments in the parser with the provided values.
|
void |
initializeTrustManagerIfRequired()
Forces the initialization of the trust manager with the arguments provided
by the user.
|
boolean |
isTrustAll()
Indicate if all certificates must be accepted.
|
boolean |
isTrustStoreInMemory()
Indicate if the trust store is in memory.
|
LDAPConnectionOptions |
populateLDAPOptions(LDAPConnectionOptions options)
Populates a set of LDAP options with state from this interaction.
|
boolean |
promptForCertificateConfirmation(Throwable errorRaised,
ApplicationTrustManager usedTrustManager,
HostPort hostPort,
org.forgerock.i18n.slf4j.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.ConsoleApplication app, SecureConnectionCliArgs secureArgs)
app
- console applicationsecureArgs
- existing set of arguments that have already been parsed and
contain some potential command line specified LDAP argumentspublic LDAPConnectionConsoleInteraction(com.forgerock.opendj.cli.ConsoleApplication app, SecureConnectionCliArgs secureArgs, boolean allowAnonymousIfNonInteractive)
app
- console applicationsecureArgs
- 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 console application 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 void setPortNumber(int portNumber)
portNumber
- port number for connectionspublic org.forgerock.opendj.ldap.Dn getBindDN()
public String getAdministratorUID()
public String getBindPassword()
public ApplicationTrustManager getTrustManager()
public KeyStore getKeyStore()
public KeyManager getKeyManager()
public boolean isTrustStoreInMemory()
public boolean isTrustAll()
public int getConnectTimeout()
public boolean checkServerCertificate(X509Certificate[] chain, String authType, String host)
chain
- The certificate chain to validateauthType
- the authentication type.host
- the host we tried to connect and that presented the certificate.public LDAPConnectionOptions populateLDAPOptions(LDAPConnectionOptions options) throws SSLConnectionException
options
- existing set of options; may be null in which case this method
will create a new set of LDAPConnectionOptions
to be
returnedSSLConnectionException
- if this interaction has specified the use of SSL and there is a
problem initializing the SSL connection factorypublic boolean promptForCertificateConfirmation(Throwable errorRaised, ApplicationTrustManager usedTrustManager, HostPort hostPort, org.forgerock.i18n.slf4j.LocalizedLogger logger)
errorRaised
- the error raised because the certificate was not trusted.usedTrustManager
- 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 initializeTrustManagerIfRequired() throws com.forgerock.opendj.cli.ArgumentException
com.forgerock.opendj.cli.ArgumentException
- if there is an error with the arguments provided by the user.public void initializeGlobalArguments(String hostName, int port, String adminUid, org.forgerock.opendj.ldap.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 org.forgerock.opendj.ldap.Dn getProvidedBindDN()
Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.