springboot整合shiro,设置不拦截css和js

login.html

 







登录页
 



 

 

 

    //Filter工厂,设置对应的过滤条件和跳转条件
    @Bean
    public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
        shiroFilterFactoryBean.setSecurityManager(securityManager);
        Map map = new HashMap<>();
        //登出
        map.put("/logout", "logout");
        //对所有用户认证
        map.put("/**", "authc");
        
       // map.put("/static/**", "anon");无效
        //去除对css和js的验证!!!
        map.put("/css/**", "anon");
        map.put("/js/**", "anon");

        map.put("/img/**", "anon");
        map.put("/login/**", "anon");
     
        //登录
        shiroFilterFactoryBean.setLoginUrl("/login");
        //首页
        shiroFilterFactoryBean.setSuccessUrl("/login/loginSuccess.html");
        //错误页面,认证不通过跳转
        shiroFilterFactoryBean.setUnauthorizedUrl("/error");
        shiroFilterFactoryBean.setFilterChainDefinitionMap(map);
        return shiroFilterFactoryBean;
    }

你可能感兴趣的:(shiro,spring,boot,html,java)