Add convenience method so subclasses can specify Authentication.setDetails().
This commit is contained in:
parent
96cd353266
commit
73349bf8f8
|
@ -1,9 +1,11 @@
|
||||||
Changes in version 0.7 (2004-xx-xx)
|
Changes in version 0.7 (2004-xx-xx)
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
* Major CVS repository restructure to support Maven and eliminate libraries
|
||||||
* Added AspectJ support (especially useful for instance-level security)
|
* Added AspectJ support (especially useful for instance-level security)
|
||||||
* Added MethodDefinitionSourceAdvisor for performance and autoproxying
|
* Added MethodDefinitionSourceAdvisor for performance and autoproxying
|
||||||
* Added MethodDefinitionMap querying of interfaces defined by secure objects
|
* Added MethodDefinitionMap querying of interfaces defined by secure objects
|
||||||
|
* Added AuthenticationProcessingFilter.setDetails for use by subclasses
|
||||||
* Refactored MethodDefinitionSource to work with Method, not MethodInvocation
|
* Refactored MethodDefinitionSource to work with Method, not MethodInvocation
|
||||||
* Refactored AbstractSecurityInterceptor to better support other AOP libraries
|
* Refactored AbstractSecurityInterceptor to better support other AOP libraries
|
||||||
* Moved MethodSecurityInterceptor to ...intercept.method.aopalliance package
|
* Moved MethodSecurityInterceptor to ...intercept.method.aopalliance package
|
||||||
|
|
|
@ -83,4 +83,18 @@ public class AuthenticationProcessingFilter extends AbstractProcessingFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(FilterConfig filterConfig) throws ServletException {}
|
public void init(FilterConfig filterConfig) throws ServletException {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provided so that subclasses may configure what is put into the
|
||||||
|
* authentication request's details property. Default implementation
|
||||||
|
* simply sets the IP address of the servlet request.
|
||||||
|
*
|
||||||
|
* @param request that an authentication request is being created for
|
||||||
|
* @param authRequest the authentication request object that should have
|
||||||
|
* its details set
|
||||||
|
*/
|
||||||
|
protected void setDetails(HttpServletRequest request,
|
||||||
|
UsernamePasswordAuthenticationToken authRequest) {
|
||||||
|
authRequest.setDetails(request.getRemoteAddr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class AuthenticationProcessingFilterTests extends TestCase {
|
||||||
|
|
||||||
Authentication result = filter.attemptAuthentication(request);
|
Authentication result = filter.attemptAuthentication(request);
|
||||||
assertTrue(result != null);
|
assertTrue(result != null);
|
||||||
|
assertEquals("127.0.0.1", result.getDetails());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNullPasswordHandledGracefully() throws Exception {
|
public void testNullPasswordHandledGracefully() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue