Getting Principal from DB by Spring Boot OAuth2 login

Viewed 183

I try to achieve the following behavior with Spring Boot:

  1. When a user wants to log in to my site he can choose from multiple OAuth2 serves (for example Google, Facebook, GitHub, etc...).
  2. He selects an option (for example google) and logs in with google OAth2.
  3. Then my site takes the e-mail address from OAuth2 and loads the user from a database to use as Principal.

So I basically want the Principal to always be the same (read from database) and do not depend on which OAuth2 server the user uses to log in.

1 Answers
Related