|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.util.cli.LDAPConnectionConsoleInteraction
public class LDAPConnectionConsoleInteraction
Supports interacting with a user through the command line to prompt for information necessary to create an LDAP connection.
Constructor Summary | |
---|---|
LDAPConnectionConsoleInteraction(ConsoleApplication app,
SecureConnectionCliArgs secureArgs)
Constructs a parameterized instance. |
Method Summary | |
---|---|
boolean |
checkServerCertificate(java.security.cert.X509Certificate[] chain)
Indicate if the certificate chain can be trusted. |
boolean |
checkServerCertificate(java.security.cert.X509Certificate[] chain,
java.lang.String authType,
java.lang.String host)
Indicate if the certificate chain can be trusted. |
java.lang.String |
getAdministratorUID()
Gets the administrator UID name that should be used for connections based on this interaction. |
java.lang.String |
getBindDN()
Gets the bind DN name that should be used for connections based on this interaction. |
java.lang.String |
getBindPassword()
Gets the bind password that should be used for connections based on this interaction. |
CommandBuilder |
getCommandBuilder()
Returns the command builder with the equivalent arguments on the non-interactive mode. |
java.lang.String |
getHostName()
Gets the host name that should be used for connections based on this interaction. |
javax.net.ssl.KeyManager |
getKeyManager()
Gets the key manager that should be used for connections based on this interaction. |
java.security.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. |
java.lang.String |
getProvidedAdminUID()
Returns the explicitly provided Admin UID from the user (interactively or through the argument). |
java.lang.String |
getProvidedBindDN()
Returns the explicitly provided bind DN from the user (interactively or through the argument). |
javax.net.ssl.TrustManager |
getTrustManager()
Gets the trust manager that should be used for connections based on this interaction. |
void |
initializeTrustManagerIfRequired()
Forces the initialization of the trust manager with the arguments provided by the user. |
boolean |
isTrustStoreInMemory()
Indicate if the truststore is in memory. |
boolean |
isUseAdminOrBindDn()
Tells whether during interaction we can ask for both the DN or the admin UID. |
LDAPConnectionOptions |
populateLDAPOptions(LDAPConnectionOptions options)
Populates a set of LDAP options with state from this interaction. |
boolean |
promptForCertificateConfirmation(java.lang.Throwable t,
ApplicationTrustManager usedTrustManager,
java.lang.String usedUrl,
boolean displayErrorMessage,
java.util.logging.Logger logger)
Prompts the user to accept the certificate. |
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 canUseSSL,
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(Message 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 or not a connection should use SSL based on this interaction. |
boolean |
useStartTLS()
Indicates whether or not a connection should use StartTLS based on this interaction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LDAPConnectionConsoleInteraction(ConsoleApplication app, SecureConnectionCliArgs secureArgs)
app
- console applicationsecureArgs
- existing set of arguments that have already
been parsed and contain some potential command line specified
LDAP argumentsMethod Detail |
---|
public void run() throws ArgumentException
ArgumentException
- if there is a problem with the argumentspublic void run(boolean canUseSSL, boolean canUseStartTLS) throws ArgumentException
canUseSSL
- whether we can propose to connect using SSL or not.canUseStartTLS
- whether we can propose to connect using Start TLS or
not.
ArgumentException
- if there is a problem with the argumentspublic boolean useSSL()
public boolean useStartTLS()
public java.lang.String getHostName()
public int getPortNumber()
public void setPortNumber(int portNumber)
portNumber
- port number for connectionspublic java.lang.String getBindDN()
public java.lang.String getAdministratorUID()
public java.lang.String getBindPassword()
public javax.net.ssl.TrustManager getTrustManager()
public java.security.KeyStore getKeyStore()
public javax.net.ssl.KeyManager getKeyManager()
public boolean isTrustStoreInMemory()
public boolean checkServerCertificate(java.security.cert.X509Certificate[] chain)
chain
- The certificate chain to validate
public boolean checkServerCertificate(java.security.cert.X509Certificate[] chain, java.lang.String authType, java.lang.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 returned
SSLConnectionException
- if this interaction has specified the use
of SSL and there is a problem initializing the SSL connection
factorypublic boolean promptForCertificateConfirmation(java.lang.Throwable t, ApplicationTrustManager usedTrustManager, java.lang.String usedUrl, boolean displayErrorMessage, java.util.logging.Logger logger)
t
- the throwable that was generated because the certificate was
not trusted.usedTrustManager
- the trustManager used when trying to establish the
connection.usedUrl
- the LDAP URL used to connect to the server.displayErrorMessage
- whether to display an error message before
asking to accept the certificate or not.logger
- the Logger used to log messages.
true
if the user accepted the certificate and
false
otherwise.public void setHeadingMessage(Message heading)
heading
- the heading that is displayed in interactive mode.public CommandBuilder getCommandBuilder()
public boolean isUseAdminOrBindDn()
true
if during interaction we can ask for both the DN
and the admin UID and false
otherwise.public void setUseAdminOrBindDn(boolean useAdminOrBindDn)
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 ArgumentException
ArgumentException
- if there is an error with the arguments provided
by the user.public java.lang.String getProvidedAdminUID()
public java.lang.String getProvidedBindDN()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |