public class AnonymousAuthenticationFilter extends GenericFilterBean implements InitializingBean
Authentication
object in the SecurityContextHolder
, and
populates it with one if needed.logger
Constructor and Description |
---|
AnonymousAuthenticationFilter()
Deprecated.
Use constructor injection version
|
AnonymousAuthenticationFilter(String key)
Creates a filter with a principal named "anonymousUser" and the single authority "ROLE_ANONYMOUS".
|
AnonymousAuthenticationFilter(String key,
Object principal,
List<GrantedAuthority> authorities) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected boolean |
applyAnonymousForThisRequest(javax.servlet.http.HttpServletRequest request)
Deprecated.
no obvious use case and can easily be achieved by other means
|
protected Authentication |
createAuthentication(javax.servlet.http.HttpServletRequest request) |
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain) |
List<GrantedAuthority> |
getAuthorities() |
Object |
getPrincipal() |
void |
setAuthenticationDetailsSource(AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,?> authenticationDetailsSource) |
void |
setKey(String key)
Deprecated.
use constructor injection instead
|
void |
setUserAttribute(UserAttribute userAttributeDefinition)
Deprecated.
use constructor injection instead
|
addRequiredProperty, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setServletContext
@Deprecated public AnonymousAuthenticationFilter()
public AnonymousAuthenticationFilter(String key)
key
- the key to identify tokens created by this filterpublic AnonymousAuthenticationFilter(String key, Object principal, List<GrantedAuthority> authorities)
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 userspublic void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class GenericFilterBean
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
@Deprecated protected boolean applyAnonymousForThisRequest(javax.servlet.http.HttpServletRequest request)
request
- to assist the method determine request detailstrue
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 requestprotected Authentication createAuthentication(javax.servlet.http.HttpServletRequest request)
public void setAuthenticationDetailsSource(AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,?> authenticationDetailsSource)
public Object getPrincipal()
public List<GrantedAuthority> getAuthorities()
@Deprecated public void setKey(String key)
@Deprecated public void setUserAttribute(UserAttribute userAttributeDefinition)