Class OAuthClient
- java.lang.Object
-
- org.apache.synapse.endpoints.auth.oauth.OAuthClient
-
public class OAuthClient extends Object
This class represents the client used to request and retrieve OAuth tokens from an OAuth server
-
-
Constructor Summary
Constructors Constructor Description OAuthClient()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
generateToken(String tokenApiUrl, String payload, String credentials, MessageContext messageContext, Map<String,String> customHeaders)
Method to generate the access token from an OAuth serverorg.apache.http.impl.client.CloseableHttpClient
getDefaultHttpClient()
-
-
-
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 serverpayload
- The payload of the requestcredentials
- 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 payloadIOException
- In the event of a problem parsing the response from the server
-
getDefaultHttpClient
public org.apache.http.impl.client.CloseableHttpClient getDefaultHttpClient()
-
-