我正在尝试在 Spring Boot 中使用 JDBC 身份验证。我正在尝试使用与默认“用户”不同的表。但是用这个方法
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery("SELECT email as USERNAME, PASSWORD as password FROM [user_account] WHERE email=?");
}
使用给定的表架构:[![f][1]][1]
我收到以下错误:
17:34:29.800 [http-nio-8081-exec-1] INFO o.s.j.support.SQLErrorCodesFactory - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]
17:34:29.806 [http-nio-8081-exec-1] WARN o.s.s.o.p.endpoint.TokenEndpoint - Handling error: [![enter image description here][2]][2]InternalAuthenticationServiceException, PreparedStatementCallback; SQL [SELECT email as USERNAME, PASSWORD as password FROM [user_account] WHERE email=?]; The index 3 is out of range.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The index 3 is out of range.
如何使用我自己的用户数据表进行 JDBC 身份验证?
慕斯王
相关分类