shiro中多用户的登陆页面(multiple login pages)配置

来源:互联网 发布:南京二手房数据 编辑:程序博客网 时间:2024/05/17 02:24
     <bean id="membersAuthc"class="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"><property name="loginUrl" value="${frontPath}/loginl" /><property name="successUrl" value="${frontPath}" /></bean><bean id="adminAuthc"class="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"><property name="loginUrl" value="${adminPath}/login" /><property name="successUrl" value="${adminPath}" /></bean><bean id="adminUser" class="org.apache.shiro.web.filter.authc.UserFilter"><property name="loginUrl" value="${adminPath}/login" /></bean><bean id="frontUser" class="org.apache.shiro.web.filter.authc.UserFilter"><property name="loginUrl" value="${frontPath}/login" /></bean><bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"><property name="securityManager" ref="securityManager" /><property name="loginUrl" value="${adminPath}/login" /><property name="successUrl" value="${adminPath}" /><property name="filters"><map><entry key="authc" value-ref="formAuthenticationFilter" /><entry key="membersAuthc" value-ref="membersAuthc" /><entry key="adminAuthc" value-ref="adminAuthc" /><entry key="adminUser" value-ref="adminUser" /></map></property><property name="filterChainDefinitions"><value>/static/** = anon/userfiles/** = anon${adminPath}/login = authc${adminPath}/logout = logout${adminPath}/** = adminUser${frontPath}/show* = frontUser</value></property></bean>

       由此可以很轻松的配置多个工程路口,比如有状态和无状态时,拥有不同的登录接口,但是希望能够共用原先的处理逻辑,此时只需要配置多个不同类型的登录页面即可。                                             
3 0