/** * Handles an {@link HttpInteraction} by applying the filtering logic. * * @param httpInteraction caller's HTTP interaction * @throws IOException if there is an I/O error * @throws ServletException if the implementation relies on the servlet API * and a servlet API call has failed */ public void handleHttpInteraction(HttpInteraction httpInteraction) throws IOException, ServletException { if (!isBrowser(httpInteraction.getHeader(HEADER_USER_AGENT)) || methodsToIgnore.contains(httpInteraction.getMethod()) || httpInteraction.getHeader(headerName) != null) { httpInteraction.proceed(); } else { httpInteraction.sendError(HttpServletResponse.SC_BAD_REQUEST, "Missing Required Header for CSRF Vulnerability Protection"); } }
/** * Handles an {@link HttpInteraction} by applying the filtering logic. * * @param httpInteraction caller's HTTP interaction * @throws IOException if there is an I/O error * @throws ServletException if the implementation relies on the servlet API * and a servlet API call has failed */ public void handleHttpInteraction(HttpInteraction httpInteraction) throws IOException, ServletException { if (!isBrowser(httpInteraction.getHeader(HEADER_USER_AGENT)) || methodsToIgnore.contains(httpInteraction.getMethod()) || httpInteraction.getHeader(headerName) != null) { httpInteraction.proceed(); } else { httpInteraction.sendError(HttpServletResponse.SC_BAD_REQUEST, "Missing Required Header for CSRF Vulnerability Protection"); } }