How to implement oAuth2 along with JWT authenticat

2019-06-14 10:27发布

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条回答
ゆ 、 Hurt°
2楼-- · 2019-06-14 10:59

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

查看更多
登录 后发表回答