From 921abefaa2e946e2b66b9b34980d720bee4340c5 Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Wed, 17 Oct 2018 11:50:34 -0400 Subject: [PATCH] Remove address and phone scope from CommonOAuth2Provider.OKTA Fixes gh-5987 --- .../security/config/oauth2/client/CommonOAuth2Provider.java | 4 ++-- .../config/oauth2/client/CommonOAuth2ProviderTests.java | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/oauth2/client/CommonOAuth2Provider.java b/config/src/main/java/org/springframework/security/config/oauth2/client/CommonOAuth2Provider.java index a98aff1726..baae88c613 100644 --- a/config/src/main/java/org/springframework/security/config/oauth2/client/CommonOAuth2Provider.java +++ b/config/src/main/java/org/springframework/security/config/oauth2/client/CommonOAuth2Provider.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,7 @@ public enum CommonOAuth2Provider { public Builder getBuilder(String registrationId) { ClientRegistration.Builder builder = getBuilder(registrationId, ClientAuthenticationMethod.BASIC, DEFAULT_REDIRECT_URL); - builder.scope("openid", "profile", "email", "address", "phone"); + builder.scope("openid", "profile", "email"); builder.userNameAttributeName(IdTokenClaimNames.SUB); builder.clientName("Okta"); return builder; diff --git a/config/src/test/java/org/springframework/security/config/oauth2/client/CommonOAuth2ProviderTests.java b/config/src/test/java/org/springframework/security/config/oauth2/client/CommonOAuth2ProviderTests.java index 6ff20bcac3..c65f671c3a 100644 --- a/config/src/test/java/org/springframework/security/config/oauth2/client/CommonOAuth2ProviderTests.java +++ b/config/src/test/java/org/springframework/security/config/oauth2/client/CommonOAuth2ProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -123,8 +123,7 @@ public class CommonOAuth2ProviderTests { assertThat(registration.getAuthorizationGrantType()) .isEqualTo(AuthorizationGrantType.AUTHORIZATION_CODE); assertThat(registration.getRedirectUriTemplate()).isEqualTo(DEFAULT_REDIRECT_URL); - assertThat(registration.getScopes()).containsOnly("openid", "profile", "email", - "address", "phone"); + assertThat(registration.getScopes()).containsOnly("openid", "profile", "email"); assertThat(registration.getClientName()).isEqualTo("Okta"); assertThat(registration.getRegistrationId()).isEqualTo("123"); }