Class AnonymousAuthenticationFilter
- java.lang.Object
-
- org.springframework.web.filter.GenericFilterBean
-
- org.springframework.security.web.authentication.AnonymousAuthenticationFilter
-
- All Implemented Interfaces:
javax.servlet.Filter,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.EnvironmentAware,org.springframework.core.env.EnvironmentCapable,org.springframework.web.context.ServletContextAware
public class AnonymousAuthenticationFilter extends org.springframework.web.filter.GenericFilterBean implements org.springframework.beans.factory.InitializingBeanDetects if there is noAuthenticationobject in theSecurityContextHolder, and populates it with one if needed.
-
-
Constructor Summary
Constructors Constructor Description AnonymousAuthenticationFilter(java.lang.String key)Creates a filter with a principal named "anonymousUser" and the single authority "ROLE_ANONYMOUS".AnonymousAuthenticationFilter(java.lang.String key, java.lang.Object principal, java.util.List<org.springframework.security.core.GrantedAuthority> authorities)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected org.springframework.security.core.AuthenticationcreateAuthentication(javax.servlet.http.HttpServletRequest request)voiddoFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain)java.util.List<org.springframework.security.core.GrantedAuthority>getAuthorities()java.lang.ObjectgetPrincipal()voidsetAuthenticationDetailsSource(org.springframework.security.authentication.AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,?> authenticationDetailsSource)
-
-
-
Constructor Detail
-
AnonymousAuthenticationFilter
public AnonymousAuthenticationFilter(java.lang.String key)
Creates a filter with a principal named "anonymousUser" and the single authority "ROLE_ANONYMOUS".- Parameters:
key- the key to identify tokens created by this filter
-
AnonymousAuthenticationFilter
public AnonymousAuthenticationFilter(java.lang.String key, java.lang.Object principal, java.util.List<org.springframework.security.core.GrantedAuthority> authorities)- Parameters:
key- key the key to identify tokens created by this filterprincipal- the principal which will be used to represent anonymous usersauthorities- the authority list for anonymous users
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classorg.springframework.web.filter.GenericFilterBean
-
doFilter
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException- Specified by:
doFilterin interfacejavax.servlet.Filter- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
createAuthentication
protected org.springframework.security.core.Authentication createAuthentication(javax.servlet.http.HttpServletRequest request)
-
setAuthenticationDetailsSource
public void setAuthenticationDetailsSource(org.springframework.security.authentication.AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,?> authenticationDetailsSource)
-
getPrincipal
public java.lang.Object getPrincipal()
-
getAuthorities
public java.util.List<org.springframework.security.core.GrantedAuthority> getAuthorities()
-
-