Skip to content

Commit

Permalink
Upgraded to Spring Boot 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
naturalprogrammer committed Oct 19, 2019
1 parent 2560297 commit 4e7632b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.naturalprogrammer.spring.lemondemo.services;

import java.util.Map;

import org.bson.types.ObjectId;
import org.springframework.security.oauth2.core.oidc.StandardClaimNames;
import org.springframework.stereotype.Service;

import com.naturalprogrammer.spring.lemon.commons.security.UserDto;
Expand Down Expand Up @@ -32,6 +35,28 @@ protected void updateUserFields(User user, User updatedUser, UserDto currentUser
user.setName(updatedUser.getName());
}

@Override
public void fillAdditionalFields(String registrationId, User user, Map<String, Object> attributes) {

String nameKey;

switch (registrationId) {

case "facebook":
nameKey = StandardClaimNames.NAME;
break;

case "google":
nameKey = StandardClaimNames.NAME;
break;

default:
throw new UnsupportedOperationException("Fetching name from " + registrationId + " login not supprrted");
}

user.setName((String) attributes.get(nameKey));
}

@Override
protected ObjectId toId(String id) {
return new ObjectId(id);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<version>2.2.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

Expand Down

0 comments on commit 4e7632b

Please sign in to comment.