且构网

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

Spring Security 4自定义登录j_spring_security_check返回http 302

更新时间:2022-06-09 00:03:13

在Spring Security 4.x中,登录URL已更改为login而不是j_spring_security_check,请参见

In Spring Security 4.x login URL has changed to login instead of j_spring_security_check, see Migrating from Spring Security 3.x to 4.x (XML Configuration).

<form name='f'action="login" method='POST'>
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
    <table>
        <tbody>
            <tr>
                <td>User Name</td>
                <td><input type="text" name="username" size="30" /></td>
            </tr>
            <tr>
                <td>Password</td>
                <td><input type="password" name="password" size="30" /></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="login" /></td>
            </tr>
        </tbody>
    </table>
</form>