How to implement oAuth2 along with JWT authentication in spring boot? [closed]

好久不见. 提交于 2019-12-08 09:12:25

问题


I am creating a spring boot web app using jhipster and mongodb as primary database. Need to implement Oauth2 for authentication along with JWT token mechanism so that every request does not hit the database for authentication. How can I implement this mechanism?


回答1:


MongoDB (or any database) is not particularly relevant to the JWT authentication since the JWT itself can be validated locally by the resource server using the public key of the authorization server without going to the database (as you say).

The key is using a JwtTokenStore

I found this github sample helpful: https://github.com/dsyer/spring-security-angular/tree/master/oauth2

I also created a basic jwt implementation with jhipster for you to look at. Here are the changes from what jhipster generated for me: https://github.com/sdoxsee/jwt-jhipster/commit/40090fcf4fab1b556ae28532c4ba8a33e70460c9



来源:https://stackoverflow.com/questions/31864288/how-to-implement-oauth2-along-with-jwt-authentication-in-spring-boot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!