簡體   English   中英

春季啟動,使用MariaDB和JWT OAuth2進行身份驗證的流程

[英]spring boot, authentification flow with MariaDB and JWT OAuth2

我想創建基於JWT的身份驗證。 用戶憑據位於Mariadb數據庫中,我使用jdbc驅動程序進行數據庫訪問。 我想使用這樣的密碼grandType發出OAuth2請求

POST /oauth/token HTTP/1.1
Host: authorization-server.com
Content-type: application/x-www-form-urlencoded

grant_type=password
&username=exampleuser
&password=1234luggage
&client_id=xxxxxxxxxx

src: https//developer.okta.com/blog/2018/06/29/what-is-the-oauth2-password-grant

用access_token和refresh_token做出響應。

我已經使用過類似的配置,例如https://github.com/nydiarra/springboot-jwt/tree/master/src/main/java/com/nouhoun/springboot/jwt/integration/config

我不太了解系統如何工作來獲取和比較存儲在數據庫中的用戶憑據。 我真的需要使用OAuth2服務器的特定數據庫架構嗎? 像這樣https://www.baeldung.com/rest-api-spring-oauth2-angularjs我有一個現有的數據庫,我可以指定驗證發送的用戶憑證數據的邏輯嗎?

謝謝你的閱讀。

您可以通過覆蓋userdetailsservice來定制從數據庫中獲取用戶數據的方式。 該bean從數據庫中獲取用戶。 請參閱本文以獲取更多詳細信息: https : //www.baeldung.com/spring-security-authentication-with-a-database

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM