public abstract class OAuthHandler extends Object implements AuthHandler
| Modifier | Constructor and Description |
|---|---|
protected |
OAuthHandler(String tokenApiUrl,
String clientId,
String clientSecret,
String authMode) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract String |
buildTokenRequestPayload(MessageContext messageContext)
Return the request payload relevant to the OAuth handler.
|
String |
getAuthMode() |
String |
getAuthType()
Gets the auth handler type of the instance.
|
String |
getClientId()
Return the client id relevant to the OAuth Handler.
|
String |
getClientSecret()
Return the client secret relevant to the OAuth Handler.
|
protected String |
getEncodedCredentials(MessageContext messageContext)
Return the base 64 encoded clientId:clientSecret relevant to the OAuth handler.
|
protected String |
getRequestParametersAsString(MessageContext messageContext)
Return the request parameters as a string.
|
Map<String,String> |
getRequestParametersMap() |
String |
getTokenUrl()
Return the token server url relevant to the OAuth handler.
|
void |
removeTokenFromCache()
Method to remove the token from the cache when the endpoint is destroyed.
|
org.apache.axiom.om.OMElement |
serializeOAuthConfiguration(org.apache.axiom.om.OMFactory omFactory)
This method returns an OMElement containing the OAuth configuration.
|
protected abstract org.apache.axiom.om.OMElement |
serializeSpecificOAuthConfigs(org.apache.axiom.om.OMFactory omFactory)
Return the OMElement for OAuth configuration relevant to the OAuth handler.
|
void |
setAuthHeader(MessageContext messageContext)
This method will set the Authorization header with the relevant auth token.
|
void |
setRequestParameters(Map<String,String> requestParameters)
Method to set the request parameter map.
|
public String getAuthType()
AuthHandlergetAuthType in interface AuthHandlerpublic void setAuthHeader(MessageContext messageContext) throws AuthException
AuthHandlersetAuthHeader in interface AuthHandlermessageContext - Message context to which the token needs to be setAuthException - In the event of errors when generating new tokenpublic void removeTokenFromCache()
public String getTokenUrl()
public String getClientId()
public String getClientSecret()
protected abstract String buildTokenRequestPayload(MessageContext messageContext) throws AuthException
AuthExceptionprotected abstract org.apache.axiom.om.OMElement serializeSpecificOAuthConfigs(org.apache.axiom.om.OMFactory omFactory)
public org.apache.axiom.om.OMElement serializeOAuthConfiguration(org.apache.axiom.om.OMFactory omFactory)
protected String getEncodedCredentials(MessageContext messageContext) throws AuthException
messageContext - Message Context of the request which will be used to resolve dynamic expressionsAuthException - In the event of errors when resolving the dynamic expressionsprotected String getRequestParametersAsString(MessageContext messageContext) throws AuthException
AuthExceptionpublic void setRequestParameters(Map<String,String> requestParameters)
requestParameters - the request parameter mappublic String getAuthMode()
Copyright © 2005–2024 Apache Software Foundation. All rights reserved.