use of org.craftercms.security.processors.impl.RequestSecurityProcessorChainImpl in project profile by craftercms.
the class RequestSecurityFilter method doFilterInternal.
/**
* Passes the request through the chain of {@link RequestSecurityProcessor}s.
*
* @param request
* @param response
* @param chain
* @throws IOException
* @throws ServletException
*/
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
RequestContext context = RequestContext.getCurrent();
if (context == null) {
context = createRequestContext(request, response);
}
List<RequestSecurityProcessor> finalSecurityProcessors = new ArrayList<>(securityProcessors);
finalSecurityProcessors.add(getLastProcessorInChain(chain));
Iterator<RequestSecurityProcessor> processorIter = finalSecurityProcessors.iterator();
RequestSecurityProcessorChain processorChain = new RequestSecurityProcessorChainImpl(processorIter);
try {
processorChain.processRequest(context);
} catch (IOException | ServletException | RuntimeException e) {
throw e;
} catch (Exception e) {
throw new ServletException(e.getMessage(), e);
}
}
Aggregations