亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 Spring Boot 中進行 JDBC 身份驗證時,是否必須使用默認的“用戶”表?

在 Spring Boot 中進行 JDBC 身份驗證時,是否必須使用默認的“用戶”表?

瀟瀟雨雨 2021-08-19 18:41:17
我正在嘗試在 Spring Boot 中使用 JDBC 身份驗證。我正在嘗試使用與默認“用戶”不同的表。但是用這個方法@Overrideprotected 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 身份驗證?
查看完整描述

1 回答

?
慕斯王

TA貢獻1864條經驗 獲得超2個贊

您可以通過附加啟用作為要選擇的第三個參數來更新您的查詢嗎

SELECT email as USERNAME, PASSWORD as password, enabled FROM [user_account] WHERE email=?


查看完整回答
反對 回復 2021-08-19
  • 1 回答
  • 0 關注
  • 255 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號