public abstract class AbstractRolesFilter extends Object implements RolesFilter
roles which will contain an array of
role names.| Constructor and Description |
|---|
AbstractRolesFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Does nothing.
|
void |
doFilter(javax.servlet.ServletRequest inRequest,
javax.servlet.ServletResponse inResponse,
javax.servlet.FilterChain inChain)
Sets a
roles session attribute containing an array of role
names for the current user principal. |
protected abstract String[] |
getRoles(Principal inPrincipal,
javax.servlet.ServletRequest inRequest)
Gets the user's roles.
|
void |
init(javax.servlet.FilterConfig fc)
Does nothing.
|
public void init(javax.servlet.FilterConfig fc)
init in interface javax.servlet.Filterfc - the filter configuration.public void doFilter(javax.servlet.ServletRequest inRequest,
javax.servlet.ServletResponse inResponse,
javax.servlet.FilterChain inChain)
throws IOException,
javax.servlet.ServletException
roles session attribute containing an array of role
names for the current user principal. It fetches the roles array from the getRoles(java.security.Principal, javax.servlet.ServletRequest)
call. If the session attribute is not null, it will not fetch the user's
roles again. If there is no session or if the user principal is not set,
this filter just passes the request and response onto the next filter in
the chain.doFilter in interface javax.servlet.FilterinRequest - the servlet request.inResponse - the servlet response.inChain - the filter chain.IOException - if the exception is thrown from downstream in the
filter chain.javax.servlet.ServletException - if the getRoles(java.security.Principal, javax.servlet.ServletRequest)
call fails or if the exception is thrown from downstream in the filter
chain.protected abstract String[] getRoles(Principal inPrincipal, javax.servlet.ServletRequest inRequest) throws javax.servlet.ServletException
doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain).inPrincipal - the user's principal. Cannot be null.inRequest - the servlet request.null should be used if an error
occurred retrieving role information.javax.servlet.ServletException - if the user's role information is
not available due to a fatal error.public void destroy()
destroy in interface javax.servlet.FilterCopyright © 2016–2018 Emory University. All rights reserved.