【发布时间】:2013-12-11 07:57:22
【问题描述】:
我正在尝试使用 mykong 网站上的示例获取 Spring 安全性...
http://www.mkyong.com/spring-security/spring-security-form-login-using-database/
我使用简单的 MySQL 表让它工作,但现在我尝试使用 db2 让它工作,其中密码存储在使用 md5 加密的数据库中。
这是我的设置方式...
<authentication-manager>
<authentication-provider>
<password-encoder hash="md5" />
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="
select employeenumber, employeepassword
from employee where employeenumber like ?
and employeestatus = 'Active'"
authorities-by-username-query="
select employeenumber, securitygroupcode
from employee
where employeenumber like ?
and employeestatus = 'Active'"
/>
</authentication-provider>
</authentication-manager>
当我尝试登录我的应用时,我输入了错误的登录详细信息,它正确地告诉我...
您的登录尝试不成功,请重试。 原因:用户名或密码无效
但是当我正确登录时,我会输入正确的登录详细信息...
您的登录尝试不成功,请重试。 引起:PreparedStatementCallback; SQL 的未分类 SQLException [选择员工编号作为用户名,员工密码作为来自 epos.employee 的密码,其中员工编号喜欢?和 sitedirectoryid = 10001 和employeestatus = 'Active']; SQL 状态 [null];错误代码[-99999]; [ibm][db2][jcc][10145][10897] 参数3无效:参数索引超出范围。嵌套异常是 com.ibm.db2.jcc.b.SqlException: [ibm][db2][jcc][10145][10897] Invalid parameter 3:参数索引超出范围。
谢谢大家
【问题讨论】:
标签: spring-mvc spring-security