过去几天我已经能够进行身份验证,但最近在重新安装我的程序后,我无法再进行身份验证。没有错误消息,hql查询显示在控制台中,页面重定向回登录页面。
安全xml
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/**" requires-channel="https" />
<intercept-url pattern='/admin/admin/**' access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern='/main/home/**' access="hasRole('ROLE_USER')" />
<intercept-url pattern='/main/user/setter/settingpage'
access="hasRole('ROLE_USER')" />
<intercept-url pattern='/main/user/setter/addpage' access="hasRole('ROLE_USER')" />
<form-login login-page="/" default-target-url="/main/home" />
<logout logout-url="/logout" invalidate-session="true" logout-success-url="/" />
输出查询
Hibernate: select userentity0_.user_id as user1_2_, userentity0_.active as
active2_, userentity0_.checker_id as checker7_2_, userentity0_.email as email2_,
userentity0_.name as name2_, userentity0_.password as password2_,
userentity0_.username as username2_ from user userentity0_ where
userentity0_.username=?
我很高兴知道为什么我不能再登录了。
答案 0 :(得分:0)
我可以在配置中看到2个问题:
1)您没有配置登录URL(它不能是\
)
<form-login login-page="/login" default-target-url="/main/home" />
2)不要在登录URL上添加授权。在开头添加此行(pattern='/main/home/**'
之前)
<intercept-url pattern="/login*" access="permitAll" />