Shiro框架项目总结

 <bean id="myShiroRealm" class="com.shiro.test.mvc.filter.MyShiroRealm"/>
    <bean id="cacheManager" class="org.apache.shiro.cache.MemoryConstrainedCacheManager"/>
    <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
        <property name="realm" ref="myShiroRealm"/>
        <property name="cacheManager" ref="cacheManager"/>
        <property name="rememberMeManager" ref="rememberMeManager"/>
    </bean>
    <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
        <property name="securityManager" ref="securityManager"/>
    </bean>
    <bean id="shiroFilter" class="com.shiro.test.mvc.filter.MyShiroFilterFactoryBean">
        <property name="securityManager" ref="securityManager"/>
        <property name="loginUrl" value="/gologin.html"/>
        <property name="successUrl" value="/index.html"/>
        <property name="unauthorizedUrl" value="/error.html"/>
        <property name="filterChainDefinitions">
            <value>
                /login.html=anon
                /gologin.html=anon
                /index.html = authc
                /side.html = authc
            </value>
        </property>
        <property name="filters">
            <map>
                <entry key="roles">
                    <bean class="com.shiro.test.mvc.filter.MyShiroFilter"/>
                </entry>
            </map>
        </property>
    </bean>

猜你喜欢

转载自blog.csdn.net/a3060858469/article/details/80791609
今日推荐