游荡的代码 2017-07-03 09:33 采纳率: 0%
浏览 1637

spring MVC与spring Security整合的问题

 配置文件:
---
web.mxl
spring security
<filter-mapping>
        <filter-name>securityFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    spring mvc
<servlet-mapping>
        <servlet-name>springMVC</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

spring配置文件
<security:http pattern="/login.do" security="none" />
<security:http auto-config='false' access-decision-manager-ref="accessDecisionManager"  entry-point-ref="authenticationEntryPoint" use-expressions="false" name="mainFilterChain">
<security:intercept-url pattern="/login.do" access="IS_AUTHENTICATED_ANONYMOUSLY" />
 <bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
         <constructor-arg name="loginFormUrl" value="/login.do" />
    </bean>
Controller

@RequestMapping(value= "/login", method = RequestMethod.GET)
public String doLogin(){
    System.out.println("我要登录");
    return "login";
}
在前台做一次登录为什么会重定向两次,也就是走了两遍doLogin()方法
  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2018-08-16 16:19
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算