当我尝试使用 Spring Security 通过数据库进行身份验证时,我搜索了几个示例,所有示例都类似于以下查询:
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="
select username,password, enabled
from users where username=?"
authorities-by-username-query="
select u.username, ur.authority from users u, user_roles ur
where u.user_id = ur.user_id and u.username =? "
/>
</authentication-provider>
</authentication-manager>
如果我将更改如下查询是错误的吗?如果不是为什么?
<security:authentication-manager>
<security:authentication-provider>
<security:jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select login.name,login.passw from login where login.name=?"
authorities-by-username-query="select login.name, login.type from login where login.name =?"/>
</security:authentication-provider>
</security:authentication-manager>
这是我的示例给出了一个错误的 SQL 异常。