List of usage examples for org.springframework.security.web.util.matcher RequestMatcher matches
boolean matches(HttpServletRequest request);
From source file:eu.supersede.fe.security.CsrfRequestMatcher.java
@Override public boolean matches(HttpServletRequest request) { for (RequestMatcher rm : matchers) { if (rm.matches(request)) { return false; }/* w w w .j ava2 s. c om*/ } // CSRF for everything else that is not an API call or an allowedMethod return true; }
From source file:cherry.foundation.springmvc.CsrfRequestMatcher.java
@Override public boolean matches(HttpServletRequest request) { if (allowedMethods.matcher(request.getMethod()).matches()) { return false; }/* ww w . jav a 2 s . c o m*/ for (RequestMatcher matcher : excludes) { if (matcher.matches(request)) { return false; } } return true; }
From source file:com.peertopark.spring.commons.CsrfRequestMatcher.java
@Override public boolean matches(HttpServletRequest httpServletRequest) { for (RequestMatcher matcher : matchers) { if (matcher.matches(httpServletRequest)) { return true; }// ww w .j av a 2 s .com } return false; }
From source file:com.ecsteam.springutils.pattern.controller.PatternController.java
/** * Will determine if a given URI matches a specified pattern, either in ant or regex format * /*w w w .j av a2 s . co m*/ * @param request The JSON from the client, deserialized * @return The original request, plus an execution timestamp and whether or not the request matched */ @RequestMapping(value = "/testpattern", method = RequestMethod.POST) public PatternResponse testPattern(@RequestBody PatternRequest request) { Assert.notNull(request); PatternResponse response = new PatternResponse(request); RequestMatcher matcher = getRequestMatcher(request); HttpServletRequest httpRequest = new PatternServletRequest(request.getTestUri()); response.setMatched(matcher.matches(httpRequest)); response.setTimestamp(System.currentTimeMillis()); return response; }
From source file:org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint.java
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { for (RequestMatcher requestMatcher : entryPoints.keySet()) { if (logger.isDebugEnabled()) { logger.debug("Trying to match using " + requestMatcher); }/*from ww w . jav a 2s . c om*/ if (requestMatcher.matches(request)) { AuthenticationEntryPoint entryPoint = entryPoints.get(requestMatcher); if (logger.isDebugEnabled()) { logger.debug("Match found! Executing " + entryPoint); } entryPoint.commence(request, response, authException); return; } } if (logger.isDebugEnabled()) { logger.debug("No match found. Using default entry point " + defaultEntryPoint); } // No EntryPoint matched, use defaultEntryPoint defaultEntryPoint.commence(request, response, authException); }
From source file:org.springframework.security.web.util.matcher.AndRequestMatcher.java
public boolean matches(HttpServletRequest request) { for (RequestMatcher matcher : requestMatchers) { if (logger.isDebugEnabled()) { logger.debug("Trying to match using " + matcher); }//from w w w .j a v a2s .com if (!matcher.matches(request)) { logger.debug("Did not match"); return false; } } logger.debug("All requestMatchers returned true"); return true; }
From source file:org.springframework.security.web.util.matcher.OrRequestMatcher.java
public boolean matches(HttpServletRequest request) { for (RequestMatcher matcher : requestMatchers) { if (logger.isDebugEnabled()) { logger.debug("Trying to match using " + matcher); }/*from w ww. j a v a 2s .c o m*/ if (matcher.matches(request)) { logger.debug("matched"); return true; } } logger.debug("No matches found"); return false; }