@Test public void canRevokeTokenTest() throws Exception { Response mockResponse = new Response(null, 200, intuit_tid); mockedHttpRequestClient.setMockResponse(mockResponse); PlatformResponse platformResponse = oAuth2PlatformClient.revokeToken("revoke-token"); assertNotNull(mockedHttpRequestClient.getServiceRequestReceived().getAuthString()); assertTrue(mockedHttpRequestClient.getServiceRequestReceived().getPostParams() .contains(new BasicNameValuePair("token", "revoke-token"))); assertEquals(platformResponse.getStatus(), "SUCCESS"); }
public PlatformResponse revokeToken(String token) throws ConnectionException { logger.debug("Enter OAuth2PlatformClient::revokeToken"); PlatformResponse platformResponse = new PlatformResponse(); try { HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig()); Request request = new Request.RequestBuilder(MethodType.POST, oauth2Config.getIntuitRevokeTokenEndpoint()) .requiresAuthentication(true) .authString(getAuthHeader()) .postParams(getUrlParameters("revoke", token, null)) .build(); Response response = client.makeRequest(request); logger.debug("Response Code : "+ response.getStatusCode()); logger.debug("intuit_tid: " + response.getIntuit_tid()); if (response.getStatusCode() != 200) { logger.debug("failed to revoke token"); platformResponse.setStatus("ERROR"); platformResponse.setErrorCode(response.getStatusCode() + ""); platformResponse.setErrorMessage("Failed to revoke token"); return platformResponse; } platformResponse.setStatus("SUCCESS"); platformResponse.setIntuit_tid(response.getIntuit_tid()); return platformResponse; } catch (Exception ex) { logger.error("Exception while calling revokeToken ", ex); throw new ConnectionException(ex.getMessage(), ex); } }
OAuth2PlatformClient { public PlatformResponse revokeToken(String token) throws ConnectionException { logger.debug("Enter OAuth2PlatformClient::revokeToken"); PlatformResponse platformResponse = new PlatformResponse(); try { HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig()); Request request = new Request.RequestBuilder(MethodType.POST, oauth2Config.getIntuitRevokeTokenEndpoint()) .requiresAuthentication(true) .authString(getAuthHeader()) .postParams(getUrlParameters("revoke", token, null)) .build(); Response response = client.makeRequest(request); logger.debug("Response Code : "+ response.getStatusCode()); logger.debug("intuit_tid: " + response.getIntuit_tid()); if (response.getStatusCode() != 200) { logger.debug("failed to revoke token"); platformResponse.setStatus("ERROR"); platformResponse.setErrorCode(response.getStatusCode() + ""); platformResponse.setErrorMessage("Failed to revoke token"); return platformResponse; } platformResponse.setStatus("SUCCESS"); platformResponse.setIntuit_tid(response.getIntuit_tid()); return platformResponse; } catch (Exception ex) { logger.error("Exception while calling revokeToken ", ex); throw new ConnectionException(ex.getMessage(), ex); } } }
OAuth2PlatformClient { public PlatformResponse revokeToken(String token) throws ConnectionException { logger.debug("Enter OAuth2PlatformClient::revokeToken"); PlatformResponse platformResponse = new PlatformResponse(); try { HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig()); Request request = new Request.RequestBuilder(MethodType.POST, oauth2Config.getIntuitRevokeTokenEndpoint()) .requiresAuthentication(true) .authString(getAuthHeader()) .postParams(getUrlParameters("revoke", token, null)) .build(); Response response = client.makeRequest(request); logger.debug("Response Code : "+ response.getStatusCode()); logger.debug("intuit_tid: " + response.getIntuit_tid()); if (response.getStatusCode() != 200) { logger.debug("failed to revoke token"); platformResponse.setStatus("ERROR"); platformResponse.setErrorCode(response.getStatusCode() + ""); platformResponse.setErrorMessage("Failed to revoke token"); return platformResponse; } platformResponse.setStatus("SUCCESS"); platformResponse.setIntuit_tid(response.getIntuit_tid()); return platformResponse; } catch (Exception ex) { logger.error("Exception while calling revokeToken ", ex); throw new ConnectionException(ex.getMessage(), ex); } } OAuth2PlatformClient(OAuth2Config oauth2Config); protected  OAuth2PlatformClient(); }
OAuth2PlatformClient { public PlatformResponse revokeToken(String token) throws ConnectionException { logger.debug("Enter OAuth2PlatformClient::revokeToken"); PlatformResponse platformResponse = new PlatformResponse(); try { HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig()); Request request = new Request.RequestBuilder(MethodType.POST, oauth2Config.getIntuitRevokeTokenEndpoint()) .requiresAuthentication(true) .authString(getAuthHeader()) .postParams(getUrlParameters("revoke", token, null)) .build(); Response response = client.makeRequest(request); logger.debug("Response Code : "+ response.getStatusCode()); logger.debug("intuit_tid: " + response.getIntuit_tid()); if (response.getStatusCode() != 200) { logger.debug("failed to revoke token"); platformResponse.setStatus("ERROR"); platformResponse.setErrorCode(response.getStatusCode() + ""); platformResponse.setErrorMessage("Failed to revoke token"); return platformResponse; } platformResponse.setStatus("SUCCESS"); platformResponse.setIntuit_tid(response.getIntuit_tid()); return platformResponse; } catch (Exception ex) { logger.error("Exception while calling revokeToken ", ex); throw new ConnectionException(ex.getMessage(), ex); } } OAuth2PlatformClient(OAuth2Config oauth2Config); protected  OAuth2PlatformClient(); BearerTokenResponse retrieveBearerTokens(String authCode, String redirectURI); BearerTokenResponse refreshToken(String refreshToken); PlatformResponse revokeToken(String token); UserInfoResponse getUserInfo(String accessToken); boolean validateIDToken(String idToken); }
OAuth2PlatformClient { public PlatformResponse revokeToken(String token) throws ConnectionException { logger.debug("Enter OAuth2PlatformClient::revokeToken"); PlatformResponse platformResponse = new PlatformResponse(); try { HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig()); Request request = new Request.RequestBuilder(MethodType.POST, oauth2Config.getIntuitRevokeTokenEndpoint()) .requiresAuthentication(true) .authString(getAuthHeader()) .postParams(getUrlParameters("revoke", token, null)) .build(); Response response = client.makeRequest(request); logger.debug("Response Code : "+ response.getStatusCode()); logger.debug("intuit_tid: " + response.getIntuit_tid()); if (response.getStatusCode() != 200) { logger.debug("failed to revoke token"); platformResponse.setStatus("ERROR"); platformResponse.setErrorCode(response.getStatusCode() + ""); platformResponse.setErrorMessage("Failed to revoke token"); return platformResponse; } platformResponse.setStatus("SUCCESS"); platformResponse.setIntuit_tid(response.getIntuit_tid()); return platformResponse; } catch (Exception ex) { logger.error("Exception while calling revokeToken ", ex); throw new ConnectionException(ex.getMessage(), ex); } } OAuth2PlatformClient(OAuth2Config oauth2Config); protected  OAuth2PlatformClient(); BearerTokenResponse retrieveBearerTokens(String authCode, String redirectURI); BearerTokenResponse refreshToken(String refreshToken); PlatformResponse revokeToken(String token); UserInfoResponse getUserInfo(String accessToken); boolean validateIDToken(String idToken);  }