Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
fix: github idp - test length of the array before accessing the secon…
Browse files Browse the repository at this point in the history
…d element

fixes gravitee-io/issues#5507
  • Loading branch information
leleueri authored and gcusnieux committed Aug 3, 2021
1 parent 61e9fb8 commit 783b45b
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -87,8 +87,11 @@ public Map<String, String> getUserProfileMapping() {
put(UserProfile.ID, isEmailRequired() ? "email" : "id");
put(UserProfile.SUB, "id");
put(UserProfile.EMAIL, "email");
put(UserProfile.FIRSTNAME, "{#jsonPath(#profile, '$.name').split(' ')[1]}");
put(UserProfile.LASTNAME, "{#jsonPath(#profile, '$.name').split(' ')[0]}");
put(UserProfile.FIRSTNAME, "{#jsonPath(#profile, '$.name').split(' ')[0]}");
put(
UserProfile.LASTNAME,
"{#jsonPath(#profile, '$.name').split(' ').length == 1 ? #jsonPath(#profile, '$.name').split(' ')[0] : #jsonPath(#profile, '$.name').split(' ')[1]}"
);
put(UserProfile.PICTURE, "avatar_url");
}
};
Expand Down

0 comments on commit 783b45b

Please sign in to comment.