mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-21 11:32:17 +00:00
Improved documentation and added methods to facilitate unit testing.
This commit is contained in:
parent
922461d19a
commit
dd39d747d5
@ -31,6 +31,15 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
* <code>web.xml</code> will not need to refer to a specific container
|
* <code>web.xml</code> will not need to refer to a specific container
|
||||||
* integration filter.
|
* integration filter.
|
||||||
* </p>
|
* </p>
|
||||||
|
*
|
||||||
|
* <P>
|
||||||
|
* The filter automatically delegates to
|
||||||
|
* <code>HttpRequestIntegrationFilter</code> if any
|
||||||
|
* <code>Authentication</code> object is detected in the
|
||||||
|
* <code>ServletRequest</code>. Failing this, it will delegate to
|
||||||
|
* <code>JbossIntegrationFilter</code> if the <code>ServletRequest</code>
|
||||||
|
* contains an instance of JBoss' <code>SimplePrincipal</code>.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Ben Alex
|
* @author Ben Alex
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@ -45,7 +54,7 @@ public class AutoIntegrationFilter extends AbstractIntegrationFilter {
|
|||||||
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
||||||
|
|
||||||
if (httpRequest.getUserPrincipal() instanceof Authentication) {
|
if (httpRequest.getUserPrincipal() instanceof Authentication) {
|
||||||
return new HttpRequestIntegrationFilter().extractFromContainer(request);
|
return getHttpServletRequest().extractFromContainer(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -55,8 +64,7 @@ public class AutoIntegrationFilter extends AbstractIntegrationFilter {
|
|||||||
if (null != httpRequest.getUserPrincipal()) {
|
if (null != httpRequest.getUserPrincipal()) {
|
||||||
if (simplePrincipalClass.isAssignableFrom(
|
if (simplePrincipalClass.isAssignableFrom(
|
||||||
httpRequest.getUserPrincipal().getClass())) {
|
httpRequest.getUserPrincipal().getClass())) {
|
||||||
return new JbossIntegrationFilter()
|
return getJbossIntegrationFilter().extractFromContainer(request);
|
||||||
.extractFromContainer(request);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
@ -67,4 +75,24 @@ public class AutoIntegrationFilter extends AbstractIntegrationFilter {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows test case to override the source of
|
||||||
|
* <code>HttpRequestIntegrationFilter</code>.
|
||||||
|
*
|
||||||
|
* @return the <code>HttpRequestIntegrationFilter</code> to use
|
||||||
|
*/
|
||||||
|
protected HttpRequestIntegrationFilter getHttpServletRequest() {
|
||||||
|
return new HttpRequestIntegrationFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows test case to override the source of
|
||||||
|
* <code>JbossIntegrationFilter</code>.
|
||||||
|
*
|
||||||
|
* @return the <code>JbossIntegrationFilter</code> to use
|
||||||
|
*/
|
||||||
|
protected JbossIntegrationFilter getJbossIntegrationFilter() {
|
||||||
|
return new JbossIntegrationFilter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user