public abstract class OAuthHandler extends java.lang.Object implements AuthHandler
Modifier | Constructor and Description |
---|---|
protected |
OAuthHandler(java.lang.String tokenApiUrl,
java.lang.String clientId,
java.lang.String clientSecret,
java.lang.String authMode) |
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.String |
buildTokenRequestPayload(MessageContext messageContext)
Return the request payload relevant to the OAuth handler.
|
java.lang.String |
getAuthMode() |
java.lang.String |
getAuthType()
Gets the auth handler type of the instance.
|
java.lang.String |
getClientId()
Return the client id relevant to the OAuth Handler.
|
java.lang.String |
getClientSecret()
Return the client secret relevant to the OAuth Handler.
|
protected java.lang.String |
getEncodedCredentials(MessageContext messageContext)
Return the base 64 encoded clientId:clientSecret relevant to the OAuth handler.
|
protected java.lang.String |
getRequestParametersAsString(MessageContext messageContext)
Return the request parameters as a string.
|
java.util.Map<java.lang.String,java.lang.String> |
getRequestParametersMap() |
java.lang.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(java.util.Map<java.lang.String,java.lang.String> requestParameters)
Method to set the request parameter map.
|
protected OAuthHandler(java.lang.String tokenApiUrl, java.lang.String clientId, java.lang.String clientSecret, java.lang.String authMode)
public java.lang.String getAuthType()
AuthHandler
getAuthType
in interface AuthHandler
public void setAuthHeader(MessageContext messageContext) throws AuthException
AuthHandler
setAuthHeader
in interface AuthHandler
messageContext
- Message context to which the token needs to be setAuthException
- In the event of errors when generating new tokenpublic void removeTokenFromCache()
public java.lang.String getTokenUrl()
public java.lang.String getClientId()
public java.lang.String getClientSecret()
protected abstract java.lang.String buildTokenRequestPayload(MessageContext messageContext) throws AuthException
AuthException
protected 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 java.lang.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 java.lang.String getRequestParametersAsString(MessageContext messageContext) throws AuthException
AuthException
public void setRequestParameters(java.util.Map<java.lang.String,java.lang.String> requestParameters)
requestParameters
- the request parameter mappublic java.util.Map<java.lang.String,java.lang.String> getRequestParametersMap()
public java.lang.String getAuthMode()
Copyright © 2005-2022 Apache Software Foundation. All Rights Reserved.