1.以下是我的shiro配置:
<!-- shiro安全認證過濾器 -->
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"><!-- 安全管理類 -->
<property name="securityManager" ref="securityManager" />
<property name="loginUrl" value="${frontPath}/login" />
<!-- <property name="successUrl" value="/f/member/index" /> -->
<property name="filters">
<map>
<entry key="authc" value-ref="formAuthenticationFilter"/>
<entry key="logout" value-ref="userLogoutFilter"/>
<entry key="user" value-ref="userFilter"/>
</map>
</property>
<!-- URL過濾器配置 -->
<property name="filterChainDefinitions">
<value>
/static/** = anon
/userfiles/** = anon
${frontPath}/login = authc
${frontPath}/logout = logout
${frontPath}/** = user
</value>
</property>
</bean>
當我需要使用兩個地址都進行登陸時
添加了一句${frontPath}/welogin = authc ,但是當我提交的地址是${frontPath}/welogin時卻沒有走登陸流程。
但是提交地址是${frontPath}/login時卻正常進行了登陸
發現該方法:
protected boolean isLoginRequest(ServletRequest request, ServletResponse response) {
return pathsMatch(getLoginUrl(), request);
}
shiro登陸時會判斷是否是該地址和配置的登陸地址是否一樣,如果不一樣則不進行登陸。
2. 登陸操作時,shiro不會記錄該登陸的請求,導致登陸成功後跳轉到配置的登陸頁,若沒有配置默認/。
3.shiro只記錄get方法請求路徑