当前位置: 首页>>代码示例>>Java>>正文


Java RequestMatcher类代码示例

本文整理汇总了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;
   }
 
开发者ID:dovier,项目名称:coj-web,代码行数:11,代码来源:SecurityConfiguration.java

示例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);
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:29,代码来源:CsrfFilter.java

示例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;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:34,代码来源:CartStateFilter.java

示例5: buildRequestMap

import org.springframework.security.web.util.RequestMatcher; //导入依赖的package包/类
/**
 * Builds the request map.
 * <p>return LinkedHashMap&lt; {@link RequestMatcher}, Collection&lt; {@link ConfigAttribute}&gt;&gt </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;
}
 
开发者ID:rockagen,项目名称:gnext,代码行数:19,代码来源:JdbcFilterInvocationSecurityMetadataSourceFactoryBean.java

示例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;
    
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:12,代码来源:AntPatternBasedAuthenticationEntryPointChain.java


注:本文中的org.springframework.security.web.util.RequestMatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。