OAuth adapter

OAuth adapter

Functionality

The OAuth Adapter allows TrustBuilder to generate the required requests or even responses for OAuth resource servers or authentication servers.

Prerequisites

A reference to an existing Http Adapter is required.

Configuration

AdapterUniqueID

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)

Other properties

  • 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

* = required

Workflow Settings

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

oauthRequest

Create a request to generate the oauth uri to redirect to.

oauthTokenRequest(code)

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.

where

code: non-empty string with the code retrieved from the response of the oauth request 

oauthResourceRequest(accessToken)

Create a request to obtain the resource from the resource server

where

accessToken: non-empty string with the accessToken retrieved from the oauthTokenRequest 

Response - API

Common Properties

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

Response codes are coming from the underlying httpadapter which are as usual: if all is ok, the status is zero, for non-zero statusses please refer to the response code of the httpadapter.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.