From ef02ab2f8a636a52934639fff8398b4cebacb8be Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Thu, 6 Sep 2018 14:36:40 -0400 Subject: [PATCH] DefaultOAuth2UserService handles OAuth2AuthorizationException --- .../oauth2/client/userinfo/DefaultOAuth2UserService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserService.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserService.java index 6a97b7f449..35f114e6f3 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserService.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserService.java @@ -23,6 +23,7 @@ import org.springframework.security.core.GrantedAuthority; import org.springframework.security.oauth2.client.http.OAuth2ErrorResponseErrorHandler; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.core.OAuth2AuthenticationException; +import org.springframework.security.oauth2.core.OAuth2AuthorizationException; import org.springframework.security.oauth2.core.OAuth2Error; import org.springframework.security.oauth2.core.user.DefaultOAuth2User; import org.springframework.security.oauth2.core.user.OAuth2User; @@ -105,7 +106,7 @@ public class DefaultOAuth2UserService implements OAuth2UserService> response; try { response = this.restOperations.exchange(request, PARAMETERIZED_RESPONSE_TYPE); - } catch (OAuth2AuthenticationException ex) { + } catch (OAuth2AuthorizationException ex) { OAuth2Error oauth2Error = ex.getError(); StringBuilder errorDetails = new StringBuilder(); errorDetails.append("Error details: [");