繁体   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