使用自定义表的Spring Security身份验证无效

时间:2014-12-19 13:55:17

标签: spring-security

我使用spring security进行身份验证,但是当我在security-config.xml文件中的userservice中使用数据库而不是硬编码用户时,它不起作用。

这是我配置的身份验证提供程序。

我正在使用PostgreSQL DB。

<authentication-provider> <jdbc-user-service data-source-ref="dataSource" users-by-username-query="select * from (select name as username, password, enabled from ss_tbluser) where username = ?" authorities-by-username-query="select * from (select u.name as username, r.description as rolename from ss_user_roles as user_role join ss_tbluser as u on u.cid = user_role.userid join ss_tblroles as r on r.cid = user_role.roleid ) where username = ?"/> </authentication-provider>

当我使用表中存在的用户登录时,我收到此错误。

2014年12月19日下午7:17:47 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息:从类路径资源加载XML bean定义[org / springframework / jdbc / support / sql-error-codes.xml] 2014年12月19日下午7:17:47 org.springframework.jdbc.support.SQLErrorCodesFactory INFO:加载了SQLErrorCodes:[DB2,Derby,H2,HSQL,Informix,MS-SQL,MySQL,Oracle,PostgreSQL,Sybase]

0 个答案:

没有答案
相关问题