/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
* Portions Copyright 2011 ForgeRock AS
*/
/**
* The panel that appears when the user is asked to provide authentication.
*
*/
{
/**
* Default constructor.
*
*/
public LoginPanel()
{
super();
createLayout();
}
/**
* {@inheritDoc}
*/
{
return INFO_CTRL_PANEL_LOGIN_PANEL_TITLE.get();
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*/
private void createLayout()
{
}
/**
* {@inheritDoc}
*/
{
return pwd;
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
super.toBeDisplayed(visible);
if (visible)
{
}
}
/**
* {@inheritDoc}
*/
public void okClicked()
{
boolean dnInvalid = false;
boolean pwdInvalid = false;
{
dnInvalid = true;
}
{
dnInvalid = true;
}
{
pwdInvalid = true;
}
if (dnInvalid)
{
}
if (pwdInvalid)
{
}
{
setEnabledOK(false);
setEnabledCancel(false);
new BackgroundTask<InitialLdapContext>()
{
/**
* {@inheritDoc}
*/
{
try
{
{
try
{
}
catch (Throwable t)
{
}
}
{
try
{
}
catch (Throwable t)
{
}
}
try
{
}
catch (Throwable t)
{
}
{
public void run()
{
}
});
return ctx;
} catch (Throwable t)
{
{
try
{
}
{
}
}
throw t;
}
}
/**
* {@inheritDoc}
*/
{
boolean handleCertificateException = false;
{
{
{
}
else if (cause ==
{
}
else
{
}
{
String h;
int p;
try
{
}
catch (Throwable t)
{
"Error parsing ldap url of ldap url.", t);
p = -1;
}
throwable, h, p,
excType);
handleCertificateException = true;
}
}
else if (throwable instanceof NamingException)
{
boolean found = false;
{
}
if (!found)
{
}
else
{
}
}
else if (throwable instanceof ConfigReadException)
{
}
else
{
// This is a bug
}
}
setEnabledCancel(true);
setEnabledOK(true);
{
}
else if (!handleCertificateException)
{
}
}
};
}
else
{
if (dnInvalid)
{
}
if (pwdInvalid)
{
}
}
}
/**
* {@inheritDoc}
*/
public void cancelClicked()
{
super.cancelClicked();
}
/**
* Displays a dialog asking the user to accept a certificate if the user
* accepts it, we update the trust manager and simulate a click on "OK" to
* re-check the authentication.
* This method assumes that we are being called from the event thread.
*/
{
dlg.setVisible(true);
if (dlg.getUserAnswer() !=
{
{
/* Simulate a click on the OK by calling in the okClicked method. */
{
public void run()
{
okClicked();
}
});
}
else
{
{
"The chain is null for the UserDataCertificateException");
}
{
"The auth type is null for the UserDataCertificateException");
}
{
"The host is null for the UserDataCertificateException");
}
}
}
if (dlg.getUserAnswer() ==
{
{
try
{
}
catch (Throwable t)
{
}
}
}
}
}