diff --git a/core/src/main/java/org/acegisecurity/adapters/AutoIntegrationFilter.java b/core/src/main/java/org/acegisecurity/adapters/AutoIntegrationFilter.java
index e003a553a5..7c4e81f02f 100644
--- a/core/src/main/java/org/acegisecurity/adapters/AutoIntegrationFilter.java
+++ b/core/src/main/java/org/acegisecurity/adapters/AutoIntegrationFilter.java
@@ -18,8 +18,6 @@ package net.sf.acegisecurity.adapters;
import net.sf.acegisecurity.Authentication;
import net.sf.acegisecurity.adapters.jboss.JbossIntegrationFilter;
-import org.jboss.security.SimplePrincipal;
-
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
@@ -33,13 +31,11 @@ import javax.servlet.http.HttpServletRequest;
* web.xml
will not need to refer to a specific container
* integration filter.
*
- * See {@link AbstractIntegrationFilter} for further information. - *
* * @author Ben Alex * @version $Id$ + * + * @see AbstractIntegrationFilter */ public class AutoIntegrationFilter extends AbstractIntegrationFilter { //~ Methods ================================================================ @@ -52,8 +48,20 @@ public class AutoIntegrationFilter extends AbstractIntegrationFilter { return new HttpRequestIntegrationFilter().extractFromContainer(request); } - if (httpRequest.getUserPrincipal() instanceof SimplePrincipal) { - return new JbossIntegrationFilter().extractFromContainer(request); + try { + Class simplePrincipalClass = Class.forName( + "org.jboss.security.SimplePrincipal"); + + if (null != httpRequest.getUserPrincipal()) { + if (simplePrincipalClass.isAssignableFrom( + httpRequest.getUserPrincipal().getClass())) { + return new JbossIntegrationFilter() + .extractFromContainer(request); + } + } + } catch (ClassNotFoundException e) { + // Can't be JBoss principal + // Expected, and normal - fall through } }