本文整理汇总了Java中org.springframework.security.web.util.RequestMatcher类的典型用法代码示例。如果您正苦于以下问题:Java RequestMatcher类的具体用法?Java RequestMatcher怎么用?Java RequestMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestMatcher类属于org.springframework.security.web.util包,在下文中一共展示了RequestMatcher类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterChain
import org.springframework.security.web.util.RequestMatcher; //导入依赖的package包/类
private List<SecurityFilterChain> filterChain() {
List<SecurityFilterChain> filters = new ArrayList<SecurityFilterChain>(12);
RequestMatcher req = new AntPathRequestMatcher("/**");
filters.add(new DefaultSecurityFilterChain(req, new SecurityContextPersistenceFilter(),
logoutFilter(),cojAuthenticationProcessingFilter(),new SecurityContextHolderAwareRequestFilter(),
rememberMeAuthenticationFilter(),anonymousAuthenticationFilter(),exceptionTranslationFilter(),filterInvocationInterceptor()
));
return filters;
}
示例2: handleRequest
import org.springframework.security.web.util.RequestMatcher; //导入依赖的package包/类
@Override
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map<String, String> urlPatternDispatchMap = (Map<String, String>) getApplicationContext().getBean("blResourceUrlPatternRequestDispatchMap");
for (Map.Entry<String, String> entry : urlPatternDispatchMap.entrySet()) {
RequestMatcher matcher = new AntPathRequestMatcher(entry.getKey());
if (matcher.matches(request)){
request.getRequestDispatcher(entry.getValue()).forward(request, response);
return;
}
}
super.handleRequest(request, response);
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:13,代码来源:BroadleafGWTModuleURLMappingResourceHttpRequestHandler.java
示例3: doFilter
import org.springframework.security.web.util.RequestMatcher; //导入依赖的package包/类
@Override
public void doFilter(ServletRequest baseRequest, ServletResponse baseResponse, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) baseRequest;
HttpServletResponse response = (HttpServletResponse) baseResponse;
boolean excludedRequestFound = false;
if (excludedRequestPatterns != null && excludedRequestPatterns.size() > 0) {
for (String pattern : excludedRequestPatterns) {
RequestMatcher matcher = new AntPathRequestMatcher(pattern);
if (matcher.matches(request)){
excludedRequestFound = true;
break;
}
}
}
// We only validate CSRF tokens on POST
if (request.getMethod().equals("POST") && !excludedRequestFound) {
String requestToken = request.getParameter(exploitProtectionService.getCsrfTokenParameter());
try {
exploitProtectionService.compareToken(requestToken);
} catch (ServiceException e) {
throw new ServletException(e);
}
}
chain.doFilter(request, response);
}
示例4: requestRequiresLock
import org.springframework.security.web.util.RequestMatcher; //导入依赖的package包/类
/**
* By default, all POST requests that are not matched by the {@link #getExcludedOrderLockRequestPatterns()} list
* (using the {@link AntPathRequestMatcher}) will be marked as requiring a lock on the Order.
*
* @param req
* @return whether or not the current request requires a lock on the order
*/
protected boolean requestRequiresLock(ServletRequest req) {
if (!(req instanceof HttpServletRequest)) {
return false;
}
if (!orderLockManager.isActive()) {
return false;
}
HttpServletRequest request = (HttpServletRequest) req;
if (!request.getMethod().equalsIgnoreCase("post")) {
return false;
}
if (excludedOrderLockRequestPatterns != null && excludedOrderLockRequestPatterns.size() > 0) {
for (String pattern : excludedOrderLockRequestPatterns) {
RequestMatcher matcher = new AntPathRequestMatcher(pattern);
if (matcher.matches(request)){
return false;
}
}
}
return true;
}
示例5: buildRequestMap
import org.springframework.security.web.util.RequestMatcher; //导入依赖的package包/类
/**
* Builds the request map.
* <p>return LinkedHashMap< {@link RequestMatcher}, Collection< {@link ConfigAttribute}>> </p>
*
* @return requestMap order-preserving map of request definitions to attribute lists
*/
protected LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> buildRequestMap() {
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
Map<String, String> resourceMap = findResources();
for (Map.Entry<String, String> entry : resourceMap.entrySet()) {
RequestMatcher key =new AntPathRequestMatcher(entry.getKey());
requestMap.put(key, SecurityConfig.createListFromCommaDelimitedString(entry.getValue()));
}
return requestMap;
}
示例6: getAppropriateEntryPoint
import org.springframework.security.web.util.RequestMatcher; //导入依赖的package包/类
private AuthenticationEntryPoint getAppropriateEntryPoint(HttpServletRequest request) {
for (String pattern : m_patterns) {
RequestMatcher matcher = new AntPathRequestMatcher(pattern);
if (matcher.matches(request)) {
return m_matchingEntryPoint;
}
}
return m_nonMatchingEntryPoint;
}