Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #185 from sef-global/development
Browse files Browse the repository at this point in the history
Release ScholarX v1.2.4
  • Loading branch information
anjula-sack authored Jul 27, 2021
2 parents ac631e7 + eb918e4 commit 19a38ca
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/main/java/org/sefglobal/scholarx/service/AuthUserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@ public void populateEmailAddressFromLinkedIn(OAuth2UserRequest oAuth2UserRequest

@SuppressWarnings("rawtypes")
public void populateImageUrl(Map<String, Object> attributes) {
Map profilePictureObject = (Map<?, ?>) attributes.get("profilePicture");
Map imageMetaData = (Map<?, ?>) profilePictureObject.get("displayImage~");
List<?> elements = (List<?>) imageMetaData.get("elements");
List<?> identifiers = (List<?>) ((Map<?, ?>) elements.get(0)).get("identifiers");
Map image = (Map<?, ?>) identifiers.get(0);
attributes.put("imageUrl", image.get("identifier"));
if (attributes.get("profilePicture") != null) {
Map profilePictureObject = (Map<?, ?>) attributes.get("profilePicture");
Map imageMetaData = (Map<?, ?>) profilePictureObject.get("displayImage~");
List<?> elements = (List<?>) imageMetaData.get("elements");
List<?> identifiers = (List<?>) ((Map<?, ?>) elements.get(0)).get("identifiers");
Map image = (Map<?, ?>) identifiers.get(0);
attributes.put("imageUrl", image.get("identifier"));
} else {
// Default profile image (If user has no LinkedIn profile image)
attributes.put("imageUrl", "https://res.cloudinary.com/dsxobn1ln/image/upload/v1626966152/profile-pic_hvfryw.jpg");
}
}
}

0 comments on commit 19a38ca

Please sign in to comment.