Skip to main content
Feedback

Design and Implementation

Sequence Diagram

Pre-processing

Image

Iamge

Post-Processing

Iamge

Implementation Details

The adapter fetches the token endpoint from the pre-input configurations and checks whether the cache key is available in the cache. If the keys do not exist or the key exists but the token has expired, a new token is fetched from the token endpoint and is cached.

note
  • In PreInputs Values, you must provide the values for defaultTtl,tokenRequestURI, readTimeout, and connectTimeout. If these values are missing, an exception will be thrown.

  • In the PostInputs Values, if introspectRequestURI is provided, then you must provide values for clientId, clientSecret, readTimeout, and connectTimeout. If these values are not provided, an exception will be thrown.

  • The adapter reads the token endpoint details provided in the Pre-Input to make a call to the token endpoint to obtain an access token in the pre-process.

  • Any failure in pre-processing, such as obtaining a token, storing an access token, or failing to connect to the token endpoint, results in a call failure.

  • Upon successful pre-processing, the adapter adds the access token received in the header authorization as a Bearer token.

  • After the target response is received for Post-processing, if introspectRequestURI details are provided in the token endpoint response, an introspect request is sent to get the details for the access token received in the token endpoint response.

  • The TTL calculated from the introspect endpoint is used to update the cache TTL only if it was set using the defaultTtl. However, if TTL was set using expires_in from the token endpoint response, then the introspect request is not required and hence not sent because expires_in received in the token response takes priority.

    If introspectRequestURI is not provided, then no introspect request will be sent, and the cache TTL value set in the PreInputs Values field will be the defaultTtl value provided in pre-inputs.

  • If the target response returns a 401 error, the existing key is deleted from the cache only if it was not created within the last 5 minutes. The key is deleted to prevent further requests from using an invalid token. The 401 error indicates that the access token is no longer valid. However, if the token was created in the last 5 minutes, no action is taken. This is done to prevent thread contention between introspect and token endpoint requests.

Error Messages

Error NameError MessageHTTP Status CodeCause
InvalidPreInputConfigurationdefaultTtl is required.412The defaultTtl is missing in Preinputs.
InvalidPreInputConfigurationdefaultTtl is not a valid number.412The defaultTtl is provided incorrectly in Preinputs.
InvalidPreInputConfigurationconnectTimeout is required and should be an integer greater than 0.412The connectTimeout is missing in Preinputs.
InvalidPreInputConfigurationreadTimeout is required and should be an integer greater than 0.412The readTimeout is missing in Preinputs.
InvalidPreInputConfigurationtokenType can only be Bearer if provided.412The tokenType is invalid. Only Bearer is allowed.
InvalidPreInputConfigurationgrantType can only be client_credentials or password if provided.412grantType is invalid. Only client_credentials and password are allowed.
InvalidPreInputConfigurationtokenRequestURI is required and should be a valid, well-formed address.412The tokenRequestURI is invalid.
InvalidPreInputConfigurationtokenClientCredentialsLocation can only be header or body if provided.412The tokenClientCredentialsLocation is invalid.
InvalidPreInputConfigurationclientId is required.412The clientId is not provided.
InvalidPreInputConfigurationclientSecret is required.412The clientSecret is not provided.
InvalidPreInputConfigurationUsername and password is required for password grant_type.412Username or password is not provided in Preinputs.
InvalidPreInputConfigurationException in decrypting client credentials.500The clientId and clientSecret are not correctly encrypted in Preinputs.
InvalidPreInputConfigurationException in decrypting username/password500Username and password are not correctly encrypted in Preinputs.
InvalidPostInputConfigurationintrospectRequestURI is required and should be a valid, well-formed address.412The introspectRequestURI is not a well-formed URI.
InvalidPostInputConfigurationconnectTimeout is required and should be an integer greater than 0.412The connectTimeout is not provided in Postinputs.
InvalidPostInputConfigurationreadTimeout is required and should be an integer greater than 0.412The readTimeout is not provided in Postinputs.
InvalidPostInputConfigurationException in decrypting client credentials.500The clientId and clientSecret are not correctly encrypted in Postinputs.
InvalidPostInputConfigurationException in decrypting username/password.500Username and password are not correctly encrypted in Postinputs.
TokenEndpointRequestFailureToken Endpoint Request Interrupted.502Request to the token endpoint failed.
TokenEndpointRequestFailureError putting fetched token in cache.500Could not put access token in cache.
TokenEndpointRequestFailureError in reading response.500Token Endpoint returned an invalid or unexpected response.
TokenEndpointRequestFailureError fetching OAuth token from cache.500Could not get existing access token from cache.
TokenEndpointRequestFailureError received in response from token endpoint.502Error received in token endpoint response.
IntrospectEndpointRequestFailureIntrospect Endpoint Request Interrupted.502Request to introspect endpoint failed.
IntrospectEndpointRequestFailureError in reading response.500Introspect Endpoint returned an invalid or unexpected response.
IntrospectEndpointRequestFailureError received in response from introspect endpoint502Error received in introspect endpoint response.
On this Page