0

在过去的几天里,我能够进行身份验证,但最近在必须重新安装我的程序后,我无法再进行身份验证。没有错误消息,控制台中显示 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=?

我会很感激知道为什么我不能再登录了。

4

1 回答 1

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" />
于 2013-05-06T03:26:27.347 回答