| | |
| | | import java.net.URI; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.ArrayList; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import javax.naming.NamingException; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | |
| | | import org.opends.quicksetup.util.UIKeyStore; |
| | | import org.opends.quicksetup.util.Utils; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | |
| | | |
| | | private String usedUrl; |
| | | |
| | | private static final Logger LOG = |
| | | Logger.getLogger(LoginDialog.class.getName()); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Constructor of the LoginDialog. |
| | |
| | | { |
| | | if (throwable != null) |
| | | { |
| | | LOG.log(Level.INFO, "Error connecting: " + throwable, throwable); |
| | | logger.debug(LocalizableMessage.raw("Error connecting: " + throwable, throwable)); |
| | | if (Utils.isCertificateException(throwable)) |
| | | { |
| | | ApplicationTrustManager.Cause cause = |
| | | trustManager.getLastRefusedCause(); |
| | | |
| | | LOG.log(Level.INFO, "Certificate exception cause: "+cause); |
| | | logger.debug(LocalizableMessage.raw("Certificate exception cause: "+cause)); |
| | | UserDataCertificateException.Type excType = null; |
| | | if (cause == ApplicationTrustManager.Cause.NOT_TRUSTED) |
| | | { |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | "Error parsing ldap url of ldap url.", t); |
| | | logger.warn(LocalizableMessage.raw( |
| | | "Error parsing ldap url of ldap url.", t)); |
| | | h = INFO_NOT_AVAILABLE_LABEL.get().toString(); |
| | | p = -1; |
| | | } |
| | |
| | | else |
| | | { |
| | | // This is a bug |
| | | LOG.log(Level.SEVERE, "Unexpected throwable: "+throwable, |
| | | throwable); |
| | | logger.error(LocalizableMessage.raw("Unexpected throwable: "+throwable, |
| | | throwable)); |
| | | displayError( |
| | | Utils.getThrowableMsg(INFO_BUG_MSG.get(), throwable), |
| | | INFO_ERROR_TITLE.get()); |
| | |
| | | |
| | | if ((chain != null) && (authType != null) && (host != null)) |
| | | { |
| | | LOG.log(Level.INFO, "Accepting certificate presented by host "+host); |
| | | logger.debug(LocalizableMessage.raw("Accepting certificate presented by host "+host)); |
| | | getTrustManager().acceptCertificate(chain, authType, host); |
| | | /* Simulate a click on the OK by calling in the okClicked method. */ |
| | | SwingUtilities.invokeLater(new Runnable() |
| | |
| | | { |
| | | if (chain == null) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | "The chain is null for the UserDataCertificateException"); |
| | | logger.warn(LocalizableMessage.raw( |
| | | "The chain is null for the UserDataCertificateException")); |
| | | } |
| | | if (authType == null) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | "The auth type is null for the UserDataCertificateException"); |
| | | logger.warn(LocalizableMessage.raw( |
| | | "The auth type is null for the UserDataCertificateException")); |
| | | } |
| | | if (host == null) |
| | | { |
| | | LOG.log(Level.WARNING, |
| | | "The host is null for the UserDataCertificateException"); |
| | | logger.warn(LocalizableMessage.raw( |
| | | "The host is null for the UserDataCertificateException")); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, "Error accepting certificate: "+t, t); |
| | | logger.warn(LocalizableMessage.raw("Error accepting certificate: "+t, t)); |
| | | } |
| | | } |
| | | } |