且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Spring Security - 发送到/ j_spring_security_check

更新时间:2022-04-30 23:19:35

/ j_spring_security_check URL映射到 UsernamePasswordAuthenticationFilter 以提供服务请求。

/j_spring_security_check URL is mapped to UsernamePasswordAuthenticationFilter to serve the requests.

UsernamePasswordAuthenticationFilter 中,默认情况下, postOnly 设置为 true

In UsernamePasswordAuthenticationFilter, by default, the postOnly is set to true.

中的以下更改spring-security.xml postOnly 设置为 false 工作。

<bean id="authenticationFilter" 
      class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"
      p:postOnly="false" />

此外,在 web.xml 中,需要以下配置:

Also, in web.xml, the following configuration is required:

<filter-mapping> <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>