Advanced authentication
Most complex authentication scenarios can be handled by modifying one or more of the following:
- The
authenticationsection of theItential Platform service instance configuration inItential Platform Admin Essentials - The endpoint configuration at
/adapter-home-dir/entities/.system, includingaction.jsonand the token request and response schemas callPropertiesin thereqObjwithinadapter.js
The pages in this section cover complex two-step token scenarios — cases where a token is retrieved in an initial request and then used in subsequent calls. Some of these patterns are more common than others, but each demonstrates how to extend or modify the standard flow to support different authentication requirements.
Some authentication methods are not yet supported by the adapter libraries. If you encounter a method that is not covered here, contact the Itential Adapters Team for assistance.
Flexible authentication
Adapter authentication is highly flexible. You can customize it at several levels, depending on what the external system requires.
Service instance configuration (IAP Admin Essentials, authentication section):
- Authentication type
- Credentials
- Token expiration
- Format of auth data on outbound requests
Endpoint configuration (/adapter-home-dir/entities/.system):
- The
getTokenaction inaction.json - Token request and response schemas
Code-level changes in adapter.js:
- Pass
authDataorcallPropertieson a per-call basis - Implement custom authentication logic for scenarios the adapter library does not support
For example, one system required a secret to be passed through SHA-1 with HMAC. This was achieved by adding SHA-1/HMAC calls to adapter.js and setting additional request headers using adapter properties — without any changes to the adapter library.
Custom authentication
If the external system requires an authentication method that the adapter libraries do not support, you have two options:
- Request a library change. Contact the Adapter Team to ask if the method can be added to the adapter library. This is the preferred path when possible.
- Implement custom authentication in
adapter.js. When a library change is not possible, or you need a faster solution, you can add authentication logic directly toadapter.js.
The adapter.js file has access to all service instance configuration settings through this.allProps. For example, to read the username from the authentication section, use this.allProps.authentication.username.
Recommended pattern
The recommended approach is to add a getAuthorization method that encapsulates the full authentication process and makes the actual request to the external system. All other adapter methods then delegate to getAuthorization rather than handling authentication themselves. This isolates authentication logic and minimizes the number of places that need to change if the authentication method evolves.
Configuration
adapter.js
Make the following changes:
- Add
getAuthorizationto themyIgnorearray insideiapGetAdapterWorkflowFunctionsso it is excluded from unit test coverage checks. - Implement the
getAuthorizationmethod. It should accept the entity, action, request object, translate flag, and any data needed for authentication. Inside the method, make the authentication call, assign the resulting auth data to the request object’s headers, and then make the actual API call. - Replace the request logic in all adapter methods with a call to
getAuthorization. - Update
genericAdapterRequeststhe same way, or those requests will fail due to missing authentication.