<property name="filterChainDefinitions"> <value> # some example chain definitions: /index.htm = anon /logout = anon /unauthed = anon /console/** = anon /css/** = anon /js/** = anon /lib/** = anon /admin/** = authc, roles[admin] /docs/** = authc, perms[document:read] /** = authc # more URL-to-FilterChain definitions here </value> </property>
2. 使用shiro提供的logout filter,自定義redirectUrl。 css
<bean id="logout" class="org.apache.shiro.web.filter.authc.LogoutFilter"> <property name="redirectUrl" value="/loginform" /> </bean>
而後將相應的url filter配置爲logout以下 web
<property name="filterChainDefinitions"> <value> # some example chain definitions: /index.htm = anon /logout = logout /unauthed = anon /console/** = anon /css/** = anon /js/** = anon /lib/** = anon /admin/** = authc, roles[admin] /docs/** = authc, perms[document:read] /** = authc # more URL-to-FilterChain definitions here </value> </property>