Use id field instead of name field for GitHub and Facebook providers.

Fixes gh-4764
This commit is contained in:
Craig Walls 2017-10-31 13:28:59 -06:00 committed by Joe Grandja
parent 881cd0befb
commit 06c4bffc5f
2 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public enum CommonOAuth2Provider {
builder.authorizationUri("https://github.com/login/oauth/authorize");
builder.tokenUri("https://github.com/login/oauth/access_token");
builder.userInfoUri("https://api.github.com/user");
builder.userNameAttributeName("name");
builder.userNameAttributeName("id");
builder.clientName("GitHub");
return builder;
}
@ -74,7 +74,7 @@ public enum CommonOAuth2Provider {
builder.authorizationUri("https://www.facebook.com/v2.8/dialog/oauth");
builder.tokenUri("https://graph.facebook.com/v2.8/oauth/access_token");
builder.userInfoUri("https://graph.facebook.com/me");
builder.userNameAttributeName("name");
builder.userNameAttributeName("id");
builder.clientName("Facebook");
return builder;
}

View File

@ -69,7 +69,7 @@ public class CommonOAuth2ProviderTests {
assertThat(providerDetails.getUserInfoEndpoint().getUri())
.isEqualTo("https://api.github.com/user");
assertThat(providerDetails.getUserInfoEndpoint().getUserNameAttributeName())
.isEqualTo("name");
.isEqualTo("id");
assertThat(providerDetails.getJwkSetUri()).isNull();
assertThat(registration.getClientAuthenticationMethod())
.isEqualTo(ClientAuthenticationMethod.BASIC);
@ -92,7 +92,7 @@ public class CommonOAuth2ProviderTests {
assertThat(providerDetails.getUserInfoEndpoint().getUri())
.isEqualTo("https://graph.facebook.com/me");
assertThat(providerDetails.getUserInfoEndpoint().getUserNameAttributeName())
.isEqualTo("name");
.isEqualTo("id");
assertThat(providerDetails.getJwkSetUri()).isNull();
assertThat(registration.getClientAuthenticationMethod())
.isEqualTo(ClientAuthenticationMethod.POST);