Externalize generation of authentication token
You can externalize the generation of the authentication token within the IBM® Sterling™ Order Management System Software by using the implementation of custom logic. Implementing this solution provides Sterling Order Management System Software with the flexibility to customize authentication and enable seamless integration with an external authentication server.
To meet the security standards, Order Service implementations must autonomously generate tokens and validate them internally because Order Service, when deployed on a separate platform, might serve as an external application. The existing version of Sterling Order Management System Software does not acquire tokens from external systems.
In your Order Service implementation, you can include supplementary headers requests to Order Service. The API Gateway intercepts requests to Order Service to run additional actions based on these headers. The existing version of the Sterling Order Management System Software does not retrieve header parameters from external systems and append them to the request that is sent to the Order Service.
User exit implementation
Sterling Order Management System Software provides the
com.yantra.ycp.japi.ue.YCPGetExternalAuthenticationTokenUE user exit (UE) in the
JWT generation logic. Implement the interface to externalize the JWT token generation for
authentication.
Method definition for user exit
public Document getAuthenticationToken(YFSEnvironment env, Document inXML);getAuthenticationToken. In
this user exit, you can write the custom logic to retrieve the token and also configure the expiry
time of the generated token.- Sample input and output of user exit
- Input
<?xml version="1.0" encoding="UTF-8"?> <Token Audience="osi" UserGroup="SYSTEM" UserId="OSIApi"/>
Handling token expiry
Based on the Token/@AuthenticationExpirationTime attribute value from the user exit output, the default expiry time is overridden. A new token is generated only when the elapsed window of the token is greater than the @AuthenticationExpirationTime multiplied by the safety factor for the token. The osi.authentication.expiration.safety.factor property, which has the default value of 0.5, is used to define the safety factor.
- Example
- If the user exit returns
@AuthenticationExpirationTime=100andosi.authentication.expiration.safety.factor=0.5, the expiry window is calculated as 100×0.5=50. So, a new token is generated every 50 minutes.