Class OAuthClient


  • public class OAuthClient
    extends Object
    This class represents the client used to request and retrieve OAuth tokens from an OAuth server
    • Constructor Detail

      • OAuthClient

        public OAuthClient()
    • Method Detail

      • generateToken

        public static String generateToken​(String tokenApiUrl,
                                           String payload,
                                           String credentials,
                                           MessageContext messageContext,
                                           Map<String,​String> customHeaders)
                                    throws AuthException,
                                           IOException
        Method to generate the access token from an OAuth server
        Parameters:
        tokenApiUrl - The token url of the server
        payload - The payload of the request
        credentials - The encoded credentials
        Returns:
        accessToken String
        Throws:
        AuthException - In the event of an unexpected HTTP status code return from the server or access_token key missing in the response payload
        IOException - In the event of a problem parsing the response from the server
      • getDefaultHttpClient

        public org.apache.http.impl.client.CloseableHttpClient getDefaultHttpClient()