Example usage for org.apache.shiro.spring.web ShiroFilterFactoryBean getObject

List of usage examples for org.apache.shiro.spring.web ShiroFilterFactoryBean getObject

Introduction

In this page you can find the example usage for org.apache.shiro.spring.web ShiroFilterFactoryBean getObject.

Prototype

public Object getObject() throws Exception 

Source Link

Document

Lazily creates and returns a AbstractShiroFilter concrete instance via the #createInstance method.

Usage

From source file:com.stormpath.sample.conf.ApplicationConfiguration.java

License:Apache License

@Bean
public AbstractShiroFilter shiroFilter() {
    ShiroFilterFactoryBean factoryBean = new ShiroFilterFactoryBean();
    factoryBean.setSecurityManager(securityManager());
    factoryBean.setLoginUrl("/login");
    factoryBean.setSuccessUrl("/home");
    factoryBean.setFilterChainDefinitionMap(filterChainDefinitionsMap());
    try {//from  ww w. j  a v a2 s  .  c o m
        return (AbstractShiroFilter) factoryBean.getObject();
    } catch (Exception e) {
        throw new IllegalStateException("Cannot build shiroFilter", e);
    }
}

From source file:com.stormpath.shiro.spring.config.web.autoconfigure.ShiroWebFilterConfiguration.java

License:Apache License

@Bean
@ConditionalOnMissingBean/*from  w  w w  . j  av  a2 s .c o  m*/
FilterRegistrationBean filterShiroFilterRegistrationBean(ShiroFilterFactoryBean shiroFilterFactoryBean)
        throws Exception {

    FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
    filterRegistrationBean.setFilter((AbstractShiroFilter) shiroFilterFactoryBean.getObject());
    filterRegistrationBean.setOrder(1);

    return filterRegistrationBean;
}

From source file:stroom.security.spring.SecurityConfiguration.java

License:Apache License

@Bean(name = "shiroFilter")
public AbstractShiroFilter shiroFilter() throws Exception {
    final ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
    shiroFilter.setSecurityManager(securityManager());
    shiroFilter.setLoginUrl("/login.html");
    shiroFilter.setSuccessUrl("/stroom.jsp");
    shiroFilter.getFilters().put("jwtFilter", new JWTAuthenticationFilter());
    //        shiroFilter.getFilterChainDefinitionMap().put("/**/secure/*", "authc, roles[USER]");
    shiroFilter.getFilterChainDefinitionMap().put("/rest/*", "jwtFilter");
    shiroFilter.getFilterChainDefinitionMap().put("/rest/**/*", "jwtFilter");
    shiroFilter.getFilterChainDefinitionMap().put("/index", "jwtFilter");
    shiroFilter.getFilterChainDefinitionMap().put("/index/*", "jwtFilter");
    shiroFilter.getFilterChainDefinitionMap().put("/**/rest/*", "jwtFilter");
    return (AbstractShiroFilter) shiroFilter.getObject();
}