This modifies the exception thrown for failures in authenticate() so that it

will be serializable.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4796 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2007-01-11 17:51:34 +00:00
parent 7fe1be8062
commit 3423ec8c18

View File

@@ -16,6 +16,9 @@
*/ */
package org.alfresco.repo.security.authentication; package org.alfresco.repo.security.authentication;
import java.io.PrintWriter;
import java.io.StringWriter;
import net.sf.acegisecurity.AuthenticationManager; import net.sf.acegisecurity.AuthenticationManager;
import net.sf.acegisecurity.UserDetails; import net.sf.acegisecurity.UserDetails;
import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken; import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
@@ -66,7 +69,15 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent
} }
catch (net.sf.acegisecurity.AuthenticationException ae) catch (net.sf.acegisecurity.AuthenticationException ae)
{ {
throw new AuthenticationException(ae.getMessage(), 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(ae.toString());
ae.printStackTrace(out);
out.close();
throw new AuthenticationException(sw.toString());
} }
} }