org.springframework.security.web.firewall.FirewalledRequest Java Examples
The following examples show how to use
org.springframework.security.web.firewall.FirewalledRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ErrorController.java From codenjoy with GNU General Public License v3.0 | 6 votes |
private ResponseEntity<ModelMap> error(Exception exception, HttpServletRequest req, ModelMap model) { String url = req.getRequestURL().toString(); // для "not found" запросов вытаскиваем доп инфо if (req instanceof SecurityContextHolderAwareRequestWrapper) { ServletRequest request = ((SecurityContextHolderAwareRequestWrapper) req).getRequest(); if (request instanceof FirewalledRequest) { ServletRequest request2 = ((FirewalledRequest) request).getRequest(); if (request2 instanceof Request) { url = String.format("%s [%s]", url, ((Request)request2).getOriginalURI()); } } } ModelAndView view = ticket.get(url, exception); model.mergeAttributes(view.getModel()); return new ResponseEntity<>(model, HttpStatus.INTERNAL_SERVER_ERROR); }
Example #2
Source File: ErrorController.java From codenjoy with GNU General Public License v3.0 | 6 votes |
private String error(Exception exception, HttpServletRequest req, ModelMap model) { String url = req.getRequestURL().toString(); // для "not found" запросов вытаскиваем доп инфо if (req instanceof SecurityContextHolderAwareRequestWrapper) { ServletRequest request = ((SecurityContextHolderAwareRequestWrapper) req).getRequest(); if (request instanceof FirewalledRequest) { ServletRequest request2 = ((FirewalledRequest) request).getRequest(); if (request2 instanceof Request) { url = String.format("%s [%s]", url, ((Request)request2).getOriginalURI()); } } } ModelAndView view = ticket.get(url, exception); model.mergeAttributes(view.getModel()); return view.getViewName(); }
Example #3
Source File: MustChangePasswordFilter.java From syncope with Apache License 2.0 | 6 votes |
@Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { if (request instanceof FirewalledRequest) { boolean isMustChangePassword = SecurityContextHolder.getContext().getAuthentication().getAuthorities().stream().anyMatch( authority -> IdRepoEntitlement.MUST_CHANGE_PASSWORD.equals(authority.getAuthority())); FirewalledRequest wrappedRequest = FirewalledRequest.class.cast(request); if (isMustChangePassword && !"POST".equalsIgnoreCase(wrappedRequest.getMethod()) && !"/users/self/changePassword".equals(wrappedRequest.getPathInfo())) { throw new AccessDeniedException("Please change your password first"); } } chain.doFilter(request, response); }
Example #4
Source File: PortalStrictHttpFirewall.java From portals-pluto with Apache License 2.0 | 4 votes |
@Override public FirewalledRequest getFirewalledRequest( HttpServletRequest request) throws RequestRejectedException { return super.getFirewalledRequest(new PortalHttpServletRequest(request)); }