The OAuth Adapter allows TrustBuilder to generate the required requests or even responses for OAuth resource servers or authentication servers.
A reference to an existing Http Adapter is required.
Unique name assigned to this adapter; the name is used to reference the adapter in the workflow. The ID has following requirements:
START with a letter or _ (underscore)
FOLLOWED by a combination of following characters: Letter, Number, '.' (dot), '-' (dash), '_' (underscore)
authUri Authentication URL (*)
tokenRetrievalUri Url to retrieve the token from upon acceptance of the client
profileRetrievalUri Url to retrieve the resource with a valid token
clientId Client ID to use in the authentication url
clientSecret Secret to use
callback url to redirect to once the client was authenticated (*)
extra Extra parameters to pass in the Authentication request
httpAdapter HttpAdapter to use to fetch token and/or resource
A request for the adapter is prepared by specifying the following properties/scripts in the adapter activity:
Input Property: the variable containing the instructions the adapter have to execute
Output Property: the variable the adapter will store the response in after execution
Before Adapter Script: script that will be executed before calling the adapter
After Adapter Script: script that will be executed after the adapter fulfilled its task
Request - API
Create a request to generate the oauth uri to redirect to.
Create a request to obtain the access_token from the oauth provider This will use the httpadapter to obtain the token from the oauth provider.
code: non-empty string with the code retrieved from the response of the oauth request
Create a request to obtain the resource from the resource server
accessToken: non-empty string with the accessToken retrieved from the oauthTokenRequest
Response - API
The response API can be applied to the variable specified in the "output property" (see "Workflow Settings"): to verify whether the action performed by the adapter was successful, to query for the data returned by the adapter.
All responses have four properties in common:
status Status flag indicating whether the response is ok (0) or not (1).
substatus Response specific number indicating what the problem was, eg. http status code
message Response specific message in case there was a problem (can be null)
rc Return Code, a human readable code based on the substatus
for both responses of oauthTokenRequest and oauthResourceRequest results can be found via the message.
Response codes are coming from the underlying httpadapter which are as usual: if all is ok, the status is zero, for non-zero statuses please refer to the response code of the httpadapter.