public void revokeToken ( ) throws OAuthSystemException , OAuthProblemException { cleanError ( ) ; if ( accessToken == null ) { throw new OAuthRuntimeException ( "Access token not provided" ) ; } OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient ( ) ; OAuthClientRequest request = OAuthClientRequest . tokenLocation ( settings . getURL ( Constants . TOKEN_REVOKE_URL ) ) . buildBodyMessage ( ) ; Map < String , String > headers = getAuthorizedHeader ( false ) ; Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "access_token" , accessToken ) ; String body = JSONUtils . buildJSON ( params ) ; request . setBody ( body ) ; OneloginOAuthJSONAccessTokenResponse oAuthResponse = ( OneloginOAuthJSONAccessTokenResponse ) httpClient . execute ( request , headers , OAuth . HttpMethod . POST , OneloginOAuthJSONAccessTokenResponse . class ) ; if ( oAuthResponse . getResponseCode ( ) == 200 ) { accessToken = null ; refreshToken = null ; expiration = null ; } else { error = oAuthResponse . getError ( ) ; errorDescription = oAuthResponse . getErrorDescription ( ) ; } }
Revokes an access token and refresh token pair .