@SuppressWarnings({"rawtypes", "unchecked"}) public void changePassword(OAuth2AccessToken token, String oldPassword, String newPassword) { HttpHeaders headers = new HttpHeaders(); headers.add(AUTHORIZATION_HEADER_KEY, token.getTokenType() + " " + token.getValue()); HttpEntity info = new HttpEntity(headers); ResponseEntity<String> response = restTemplate.exchange(authorizationUrl + "/userinfo", HttpMethod.GET, info, String.class); Map<String, Object> responseMap = JsonUtil.convertJsonToMap(response.getBody()); String userId = (String) responseMap.get("user_id"); Map<String, Object> body = new HashMap<String, Object>(); body.put("schemas", new String[] {"urn:scim:schemas:core:1.0"}); body.put("password", newPassword); body.put("oldPassword", oldPassword); HttpEntity<Map> httpEntity = new HttpEntity<Map>(body, headers); restTemplate.put(authorizationUrl + "/User/{id}/password", httpEntity, userId); }
public CloudInfo getInfo() { String resp = getRestTemplate().getForObject(getCloudControllerUrl() + "/info", String.class); Map<String, Object> infoMap = JsonUtil.convertJsonToMap(resp); return new CloudInfo(infoMap); }