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


Java PathMatchingFilterChainResolver类代码示例

本文整理汇总了Java中org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver的典型用法代码示例。如果您正苦于以下问题:Java PathMatchingFilterChainResolver类的具体用法?Java PathMatchingFilterChainResolver怎么用?Java PathMatchingFilterChainResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PathMatchingFilterChainResolver类属于org.apache.shiro.web.filter.mgt包,在下文中一共展示了PathMatchingFilterChainResolver类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createInstance

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Override
protected AbstractShiroFilter createInstance() throws Exception {
	SecurityManager securityManager = getSecurityManager();
	if (securityManager == null){
		throw new BeanInitializationException("SecurityManager property must be set.");
	}

	if (!(securityManager instanceof WebSecurityManager)){
		throw new BeanInitializationException("The security manager does not implement the WebSecurityManager interface.");
	}

	PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
	FilterChainManager chainManager = createFilterChainManager();
	chainResolver.setFilterChainManager(chainManager);
	return new MySpringShiroFilter((WebSecurityManager)securityManager, chainResolver);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:MyShiroFilterFactoryBean.java

示例2: createChainResolver

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
protected FilterChainResolver createChainResolver(Map<String, Filter> chainFilters) {
    DefaultFilterChainManager chainManager = new DefaultFilterChainManager();

    // load filters
    chainFilters.forEach((name, filter) -> chainManager.addFilter(name, filter));

    if (urls != null) {
        urls.forEach((url, value) -> {
            LOGGER.info("Loading url chain {} -> {}", url, value);
            chainManager.createChain(url, value);
        });
    }

    PathMatchingFilterChainResolver resolver = new PathMatchingFilterChainResolver();
    resolver.setFilterChainManager(chainManager);
    return resolver;
}
 
开发者ID:bootique,项目名称:bootique-shiro,代码行数:18,代码来源:MappedShiroFilterFactory.java

示例3: configureShiroWeb

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Override
protected void configureShiroWeb() {
  bindRealm().to(EmptyRealm.class); // not used in practice, just here to keep Shiro module happy

  bindSingleton(SessionFactory.class, NexusSessionFactory.class);
  bindSingleton(SessionStorageEvaluator.class, NexusSessionStorageEvaluator.class);
  bindSingleton(SubjectDAO.class, NexusSubjectDAO.class);

  // configure our preferred security components
  bindSingleton(SessionDAO.class, NexusSessionDAO.class);
  bindSingleton(Authenticator.class, FirstSuccessfulModularRealmAuthenticator.class);
  bindSingleton(Authorizer.class, ExceptionCatchingModularRealmAuthorizer.class);
  bindSingleton(FilterChainManager.class, DynamicFilterChainManager.class);

  // path matching resolver has several constructors so we need to point Guice to the appropriate one
  bind(FilterChainResolver.class).toConstructor(ctor(PathMatchingFilterChainResolver.class)).asEagerSingleton();

  // bindings used by external modules
  expose(FilterChainResolver.class);
  expose(FilterChainManager.class);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:22,代码来源:WebSecurityModule.java

示例4: getFilterChainResolver

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
/**
 * @return the default filter chain resolver for this application
 */
@Produces
public FilterChainResolver getFilterChainResolver() {

    if (this.filterChainResolver == null) {

        final FilterChainManager chainManager = new DefaultFilterChainManager();

        chainManager.addFilter("anon", new AnonymousFilter());
        chainManager.addFilter("authc", this.configureFormAuthentication());
        chainManager.addFilter("perms", new PermissionsAuthorizationFilter());

        final PathMatchingFilterChainResolver resolver
                = new PathMatchingFilterChainResolver();

        chainManager.createChain("/secured/**", "authc");
        chainManager.createChain("/index.xhtml", "anon");
        
        resolver.setFilterChainManager(chainManager);
        
        this.filterChainResolver = resolver;
    }
    return this.filterChainResolver;
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:27,代码来源:ShiroConfiguration.java

示例5: init

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Override
public void init() throws Exception {
    super.init();


    String shiroConfigFile = GojaConfig.getAppSecurityConfig();
    final File configFolderFile = GojaConfig.getConfigFolderFile();
    shiroConfig = configFolderFile == null ? PropKit.use(shiroConfigFile).getProperties()
            : PropKit.use(FileUtils.getFile(configFolderFile, shiroConfigFile)).getProperties();

    WebSecurityManager webSecurityManager = initSecurityManager();
    FilterChainManager manager = createFilterChainManager();

    //Expose the constructed FilterChainManager by first wrapping it in a
    // FilterChainResolver implementation. The AbstractShiroFilter implementations
    // do not know about FilterChainManagers - only resolvers:
    PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
    chainResolver.setFilterChainManager(manager);

    setSecurityManager(webSecurityManager);
    setFilterChainResolver(chainResolver);
}
 
开发者ID:GojaFramework,项目名称:goja,代码行数:23,代码来源:GojaShiroFilter.java

示例6: FDWebEnvironment

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
public FDWebEnvironment() {
    BasicHttpAuthenticationFilter authc = new CorsBasicHttpAuthenticationFilter();
    LogoutFilter logout = new LogoutFilter();
    logout.setRedirectUrl("http://www.freedomotic.com/");
    
    FilterChainManager fcMan = new DefaultFilterChainManager();
    fcMan.addFilter("authc", authc);
    fcMan.addFilter("logout", logout);
    fcMan.createChain("/auth/logout", "logout");
    fcMan.createChain("/v3/**", "authc");

    PathMatchingFilterChainResolver resolver = new PathMatchingFilterChainResolver();
    resolver.setFilterChainManager(fcMan);

    setFilterChainResolver(resolver);
    setWebSecurityManager(RestAPIv3.defaultWebSecurityManager);
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:18,代码来源:FDWebEnvironment.java

示例7: MySpringShiroFilter

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
public MySpringShiroFilter(
		WebSecurityManager securityManager, PathMatchingFilterChainResolver chainResolver) {
	super();
	if (securityManager == null){
		throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
	}
	setSecurityManager(securityManager);
	if (chainResolver != null){
		setFilterChainResolver(chainResolver);
	}
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:12,代码来源:MyShiroFilterFactoryBean.java

示例8: getFilterChainResolver

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Produces
public FilterChainResolver getFilterChainResolver() {
    FilterChainResolver filterChainResolver = null;
    if (filterChainResolver == null) {
        FormAuthenticationFilter authc = new FormAuthenticationFilter();
        AnonymousFilter anon = new AnonymousFilter();
        UserFilter user = new UserFilter();

        authc.setLoginUrl(WebPages.LOGIN_URL);
        user.setLoginUrl(WebPages.LOGIN_URL);

        FilterChainManager fcMan = new DefaultFilterChainManager();
        fcMan.addFilter("authc", authc);
        fcMan.addFilter("anon", anon);
        fcMan.addFilter("user", user);

        fcMan.createChain("/index.html", "anon");
        fcMan.createChain("/css/**", "anon");
        fcMan.createChain("/api/**", "anon");
        fcMan.createChain(WebPages.LOGIN_URL, "authc");
        fcMan.createChain("/**", "user");

        PathMatchingFilterChainResolver resolver = new PathMatchingFilterChainResolver();
        resolver.setFilterChainManager(fcMan);
        filterChainResolver = resolver;
    }
    return filterChainResolver;
}
 
开发者ID:nebrass,项目名称:pairing-shiro-javaee7,代码行数:29,代码来源:ShiroConfiguration.java

示例9: createInstance

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
protected FilterChainResolver createInstance(Ini ini) {
    FilterChainResolver filterChainResolver = createDefaultInstance();
    if (filterChainResolver instanceof PathMatchingFilterChainResolver) {
        PathMatchingFilterChainResolver resolver = (PathMatchingFilterChainResolver) filterChainResolver;
        FilterChainManager manager = resolver.getFilterChainManager();
        buildChains(manager, ini);
    }
    return filterChainResolver;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:10,代码来源:IniFilterChainResolverFactory.java

示例10: createDefaultInstance

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
protected FilterChainResolver createDefaultInstance() {
    FilterConfig filterConfig = getFilterConfig();
    if (filterConfig != null) {
        return new PathMatchingFilterChainResolver(filterConfig);
    } else {
        return new PathMatchingFilterChainResolver();
    }
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:9,代码来源:IniFilterChainResolverFactory.java

示例11: testFilter

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Test
public void testFilter() {
    AbstractShiroFilter shiroFilter = (AbstractShiroFilter) wac.getBean("shiroFilter");
    PathMatchingFilterChainResolver resolver = (PathMatchingFilterChainResolver) shiroFilter
            .getFilterChainResolver();
    DefaultFilterChainManager fcManager = (DefaultFilterChainManager) resolver.getFilterChainManager();
    NamedFilterList chain = fcManager.getChain("/users/**");
    assertNotNull(chain);
    assertEquals(chain.size(), 2);
    Filter[] filters = new Filter[chain.size()];
    filters = chain.toArray(filters);
    assertTrue(filters[1] instanceof TokenFilter);
}
 
开发者ID:howiefh,项目名称:jee-restful-web,代码行数:14,代码来源:OAuthTest.java

示例12: getFilterChainResolver

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
/**
 * @return the default filter chain resolver for this application
 */
@Produces
public FilterChainResolver getFilterChainResolver() {

    if (this.filterChainResolver == null) {

        final FilterChainManager chainManager = new DefaultFilterChainManager();

        chainManager.addFilter("anon", new AnonymousFilter());
        chainManager.addFilter("authc", this.configureFormAuthentication());
        chainManager.addFilter("perms", new PermissionsAuthorizationFilter());

        final PathMatchingFilterChainResolver resolver
                = new PathMatchingFilterChainResolver();

        chainManager.createChain("/index.xhtml", "anon");
        
        chainManager.createChain("/secured/car/**", "perms[car:access]");
        chainManager.createChain("/secured/owner/**", "perms[owner:access]");
        
        chainManager.createChain("/secured/**", "authc");
        chainManager.createChain("/api/**", "authcBasic");
        
        resolver.setFilterChainManager(chainManager);
        
        this.filterChainResolver = resolver;
    }
    return this.filterChainResolver;
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:32,代码来源:ShiroConfiguration.java

示例13: getFilter

import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
/**
 * Returns a {@link Filter} registered to {@link FilterChainManager} with the
 * specified name. The default filter instances are typically named  of the
 * {@link DefaultFilter} enum constant.
 *
 * @param filterName the filter's name
 * @return the {@link Filter} registered with the specified name
 */
protected Filter getFilter(String filterName) {
    PathMatchingFilterChainResolver filterChainResolver =
            (PathMatchingFilterChainResolver) getFilterChainResolver();

    if (filterChainResolver != null) {
        FilterChainManager filterChainManager = filterChainResolver.getFilterChainManager();

        Map<String, Filter> filters = filterChainManager.getFilters();

        return filters.get(filterName);
    }
    return null;
}
 
开发者ID:panifex,项目名称:panifex-platform,代码行数:22,代码来源:SecurityFilterImpl.java


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