org.springframework.security.web.authentication
Class AnonymousAuthenticationFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.security.web.authentication.AnonymousAuthenticationFilter
- All Implemented Interfaces:
- javax.servlet.Filter, BeanNameAware, DisposableBean, InitializingBean, ServletContextAware
public class AnonymousAuthenticationFilter
- extends GenericFilterBean
- implements InitializingBean
Detects if there is no Authentication
object in the SecurityContextHolder
, and
populates it with one if needed.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnonymousAuthenticationFilter
public AnonymousAuthenticationFilter()
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interface InitializingBean
- Overrides:
afterPropertiesSet
in class GenericFilterBean
doFilter
public void doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
- Specified by:
doFilter
in interface javax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
applyAnonymousForThisRequest
protected boolean applyAnonymousForThisRequest(javax.servlet.http.HttpServletRequest request)
- Enables subclasses to determine whether or not an anonymous authentication token should be setup for
this request. This is useful if anonymous authentication should be allowed only for specific IP subnet ranges
etc.
- Parameters:
request
- to assist the method determine request details
- Returns:
true
if the anonymous token should be setup for this request (provided that the request
doesn't already have some other Authentication
inside it), or false
if no
anonymous token should be setup for this request
createAuthentication
protected Authentication createAuthentication(javax.servlet.http.HttpServletRequest request)
getKey
public String getKey()
getUserAttribute
public UserAttribute getUserAttribute()
setAuthenticationDetailsSource
public void setAuthenticationDetailsSource(AuthenticationDetailsSource authenticationDetailsSource)
setKey
public void setKey(String key)
setUserAttribute
public void setUserAttribute(UserAttribute userAttributeDefinition)