且构网

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

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

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

在 Spring Security 4.x 中,登录 URL 已更改为 login 而不是 j_spring_security_check,请参阅 从 Spring Security 3.x 迁移到 4.x(XML 配置).

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>