Wes
Wes

Reputation: 7067

Fetch authentication provider for spring oauth2

Been going through the examples on the spring website https://spring.io/guides/tutorials/spring-boot-oauth2/

I've made minimal changes to also allow google as a provider. However the authentication details format is different depending on the provider.

How can one tell given the Principal which provider it was authenticated against so that I can correctly read the information out of the Principal?

There doesn't seem to be any common way I can extract full name, email address and provider id out of all authentication providers.

Upvotes: 1

Views: 231

Answers (1)

Jarob22
Jarob22

Reputation: 380

Use a custom successHandler that implements AuthenticationSuccessHandler, you'll get all the jwt info from the Authentication object.

Upvotes: 1

Related Questions