From 3423ec8c1800cf7f06fb1baa3614dfc7d5c6838a Mon Sep 17 00:00:00 2001 From: Britt Park Date: Thu, 11 Jan 2007 17:51:34 +0000 Subject: [PATCH] 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 --- .../authentication/AuthenticationComponentImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/repo/security/authentication/AuthenticationComponentImpl.java b/source/java/org/alfresco/repo/security/authentication/AuthenticationComponentImpl.java index 886f4d1210..56b5713a39 100644 --- a/source/java/org/alfresco/repo/security/authentication/AuthenticationComponentImpl.java +++ b/source/java/org/alfresco/repo/security/authentication/AuthenticationComponentImpl.java @@ -16,6 +16,9 @@ */ package org.alfresco.repo.security.authentication; +import java.io.PrintWriter; +import java.io.StringWriter; + import net.sf.acegisecurity.AuthenticationManager; import net.sf.acegisecurity.UserDetails; import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken; @@ -66,7 +69,15 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent } 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()); } }