mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 15:25:49 +00:00
Add facebook login
This commit is contained in:
parent
fbdafee1a6
commit
8301534007
1 changed files with 6 additions and 4 deletions
|
@ -161,17 +161,19 @@ public class UserController extends WebSocketSender {
|
|||
String email;
|
||||
String providerId;
|
||||
String provider = authentication.getAuthorizedClientRegistrationId();
|
||||
Map<String,Object> attributes = authentication.getPrincipal().getAttributes();
|
||||
Map<String, Object> attributes = authentication.getPrincipal().getAttributes();
|
||||
|
||||
if (provider.equals(CommonAttribute.GOOGLE)) {
|
||||
firstName = attributes.get(CommonAttribute.GOOGLE_FIRSTNAME).toString();
|
||||
lastName = attributes.get(CommonAttribute.GOOGLE_LASTNAME).toString();
|
||||
providerId = attributes.get(CommonAttribute.GOOGLE_PROVIDER_ID).toString();
|
||||
} else if (provider.equals(CommonAttribute.GITHUB)) {
|
||||
}
|
||||
else if (provider.equals(CommonAttribute.GITHUB)) {
|
||||
firstName = attributes.get(CommonAttribute.GITHUB_FIRSTNAME).toString();
|
||||
lastName = attributes.get(CommonAttribute.GITHUB_LASTNAME).toString();
|
||||
providerId = attributes.get(CommonAttribute.GITHUB_PROVIDER_ID) .toString();
|
||||
} else {
|
||||
providerId = attributes.get(CommonAttribute.GITHUB_PROVIDER_ID).toString();
|
||||
}
|
||||
else {
|
||||
firstName = attributes.get(CommonAttribute.FACEBOOK_FIRSTNAME).toString();
|
||||
lastName = attributes.get(CommonAttribute.FACEBOOK_LASTNAME).toString();
|
||||
providerId = attributes.get(CommonAttribute.FACEBOOK_PROVIDER_ID).toString();
|
||||
|
|
Loading…
Reference in a new issue