Example usage for org.apache.shiro.web.filter.mgt FilterChainManager createChain

List of usage examples for org.apache.shiro.web.filter.mgt FilterChainManager createChain

Introduction

In this page you can find the example usage for org.apache.shiro.web.filter.mgt FilterChainManager createChain.

Prototype

void createChain(String chainName, String chainDefinition);

Source Link

Document

Creates a filter chain for the given chainName with the specified chainDefinition String.

Usage

From source file:com.freedomotic.plugins.devices.restapiv3.auth.FDWebEnvironment.java

License:Open Source License

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);//from   w ww .j  a  v  a  2 s  .co m
    setWebSecurityManager(RestAPIv3.defaultWebSecurityManager);
}

From source file:com.jfaker.framework.security.shiro.ShiroPlugin.java

License:Apache License

private void createChain(FilterChainManager manager, String key, String value) {
    log.info("add authority url[url=" + key + "\tvalue=" + value + "]");
    manager.createChain(key, MessageFormat.format(PREMISSION_FORMAT, value));
}

From source file:com.syd.shiro.ShiroPlugin.java

License:Apache License

@SuppressWarnings("unused")
private void createChain(FilterChainManager manager, String key, String value) {
    log.info("add authority url[url=" + key + "\tvalue=" + value + "]");
    manager.createChain(key, MessageFormat.format(PREMISSION_FORMAT, value));
}

From source file:myStuff.rest.shiro.ShiroHelper.java

License:Apache License

public static FilterChainResolver getFilterChainResolver() {
    if (filterChainResolver == null) {
        BasicHttpAuthenticationFilter authcBasic = new MyFilter();
        authcBasic.setEnabled(true);//from ww  w . ja  v a 2s.  c o  m

        FilterChainManager fcMan = new DefaultFilterChainManager();
        fcMan.addFilter("authcBasic[permissive]", authcBasic);
        fcMan.createChain("/**", "authcBasic[permissive]");

        PathMatchingFilterChainResolver resolver = new PathMatchingFilterChainResolver();
        resolver.setFilterChainManager(fcMan);
        filterChainResolver = resolver;
    }
    return filterChainResolver;
}

From source file:org.youi.framework.security.DefaultShiroFilterFactoryBean.java

License:Apache License

@Override
protected FilterChainManager createFilterChainManager() {
    FilterChainManager manager = super.createFilterChainManager();
    if (urlResourceManager == null) {
        urlResourceManager = new DefaultUrlRecourceManager();
    }// w w w . j ava 2  s  . c om
    //build up the chains:
    Map<String, String> chains = urlResourceManager.getFilterChainDefinitionMap();
    if (!CollectionUtils.isEmpty(chains)) {
        for (Map.Entry<String, String> entry : chains.entrySet()) {
            String url = entry.getKey();
            String chainDefinition = entry.getValue();
            manager.createChain(url, chainDefinition);
        }
    }
    return manager;
}