From f8032bc32ade1eacd15c050102484212eef3f7d4 Mon Sep 17 00:00:00 2001 From: Paul Smelser Date: Tue, 13 Feb 2018 12:43:18 -0500 Subject: [PATCH] #154 fixing javadoc --- release-notes.md | 6 ++++++ .../partnercenter/security/AzureADAuthTemplate.java | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/release-notes.md b/release-notes.md index 1760a83..cf8aee0 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,6 +1,12 @@ # Release Notes: Spring Social for Microsoft Partner Center +## 6.2.1 + +#### Bug Fixes +1. Fixed AuthorizationTemplate to ensure failed rest calls get wrapped as ApiAuthorizationException. + ## 6.2.0 + #### Added 1. ServiceRequestOperations added to allow for creating and retrieving service requests through the API diff --git a/src/main/java/org/springframework/social/partnercenter/security/AzureADAuthTemplate.java b/src/main/java/org/springframework/social/partnercenter/security/AzureADAuthTemplate.java index 6f38953..caa157c 100644 --- a/src/main/java/org/springframework/social/partnercenter/security/AzureADAuthTemplate.java +++ b/src/main/java/org/springframework/social/partnercenter/security/AzureADAuthTemplate.java @@ -247,7 +247,11 @@ public boolean isSlf4jEnabled() { protected AccessGrant postForAccessGrant(String accessTokenUrl, HttpHeaders headers, MultiValueMap parameters) { headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); HttpEntity> request = new HttpEntity<>(parameters, headers); - return extractAccessGrant(getRestTemplate().postForObject(accessTokenUrl, request, Map.class)); + try { + return extractAccessGrant(getRestTemplate().postForObject(accessTokenUrl, request, Map.class)); + } catch (HttpStatusCodeException e) { + throw buildAuthFault(e); + } } /** @@ -265,8 +269,11 @@ protected AccessGrant postForAccessGrant(String accessTokenUrl, HttpHeaders head protected AccessGrant postForAccessGrant(String accessTokenUrl, MultiValueMap parameters) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - - return extractAccessGrant(getRestTemplate().postForObject(accessTokenUrl, new HttpEntity<>(parameters, headers), Map.class)); + try { + return extractAccessGrant(getRestTemplate().postForObject(accessTokenUrl, new HttpEntity<>(parameters, headers), Map.class)); + } catch (HttpStatusCodeException e) { + throw buildAuthFault(e); + } } private AzureADSecurityToken postForADToken(){