Class SecurityFilter
java.lang.Object
org.eximeebpms.bpm.webapp.impl.security.filter.SecurityFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
Simple filter implementation which delegates to a list of FilterRules,
evaluating their SecurityFilterRule#setAuthorized(org.eximeebpms.bpm.webapp.impl.security.filter.AppRequest) condition
for the given request.
This filter must be configured using a init-param in the web.xml file. The parameter must be named "configFile" and point to the configuration file located in the servlet context.
- Author:
- Daniel Meyer, nico.rehwaldt
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Authorizationauthorize(String requestMethod, String requestUri, List<SecurityFilterRule> filterRules) Iterate over a number of filter rules and match them against the specified request.voiddestroy()voiddoFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) voiddoFilterSecure(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) protected StringgetRequestUri(jakarta.servlet.http.HttpServletRequest request) voidinit(jakarta.servlet.FilterConfig filterConfig) protected booleanisAuthenticated(jakarta.servlet.http.HttpServletRequest request) protected voidloadFilterRules(jakarta.servlet.FilterConfig filterConfig, String applicationPath) protected voidsendForbidden(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected voidsendForbiddenApplicationAccess(String application, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected voidsendUnauthorized(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
-
Field Details
-
filterRules
-
-
Constructor Details
-
SecurityFilter
public SecurityFilter()
-
-
Method Details
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Specified by:
doFilterin interfacejakarta.servlet.Filter- Throws:
IOExceptionjakarta.servlet.ServletException
-
doFilterSecure
public void doFilterSecure(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
init
public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Filter- Throws:
jakarta.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Filter
-
authorize
public static Authorization authorize(String requestMethod, String requestUri, List<SecurityFilterRule> filterRules) Iterate over a number of filter rules and match them against the specified request.- Parameters:
request-filterRules-- Returns:
- the joined
AuthorizationStatusfor this request matched against all filter rules
-
loadFilterRules
protected void loadFilterRules(jakarta.servlet.FilterConfig filterConfig, String applicationPath) throws jakarta.servlet.ServletException - Throws:
jakarta.servlet.ServletException
-
sendForbidden
protected void sendForbidden(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
sendUnauthorized
protected void sendUnauthorized(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
sendForbiddenApplicationAccess
protected void sendForbiddenApplicationAccess(String application, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
isAuthenticated
protected boolean isAuthenticated(jakarta.servlet.http.HttpServletRequest request) -
getRequestUri
-