02-18-2009 11:50 AM
/**
* Authenticate
*/
protected void authenticateImpl(String userName, char[] password) throws AuthenticationException
{
try
{
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userName,
new String(password));
authenticationManager.authenticate(authentication);
setCurrentUser(userName);
}
catch (net.sf.acegisecurity.AuthenticationException ae)
{
// This is a bit gross, I admit, but when LDAP is
// configured ae, above, is non-serializable and breaks
// remote authentication.
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
out.println([b]ae.toString()[/b]);
ae.printStackTrace(out);
out.close();
throw new AuthenticationException(sw.toString());
}
}
/**
* Action handler called for OK button press on Change My Password screen
* For this screen the user is required to enter their old password - effectively login.
*/
public String changeMyPasswordOK()
{
String outcome = DIALOG_CLOSE;
if (this.password != null && this.confirm != null && this.password.equals(this.confirm))
{
try
{
String userName = (String)this.person.getProperties().get(ContentModel.PROP_USERNAME);
this.getAuthenticationService().updateAuthentication(userName, this.oldPassword.toCharArray(), this.password.toCharArray());
}
catch (Exception e)
{
outcome = null;
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext
.getCurrentInstance(), Repository.ERROR_GENERIC), [b]e.getMessage()[/b]), e);
}
}
else
{
outcome = null;
Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(),
ERROR_PASSWORD_MATCH));
}
return outcome;
}
02-25-2009 11:34 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.