KEYCLOAK-5566 Google IdP doesn't reliably fetch user's full name (#4503)

This commit is contained in:
Václav Muzikář 2017-10-03 20:56:25 +02:00 committed by Stian Thorgersen
parent 684c8dd0ce
commit da146f13c1

View file

@ -88,6 +88,12 @@ public class GoogleIdentityProvider extends OIDCIdentityProvider implements Soci
identity.getContextData().put(VALIDATED_ID_TOKEN, idToken);
if (!getConfig().isDisableUserInfoService() && accessToken != null && name == null) {
JsonNode userInfo = SimpleHttp.doGet(getUserInfoUrl(), session)
.header("Authorization", "Bearer " + accessToken).asJson();
name = getJsonProperty(userInfo, "name");
}
identity.setId(id);
identity.setName(name);
identity.setEmail(email);