Added new custom headers in the DpsHeaders library
In order to support the Multiple Identity provider Support functionality, we want to add new custom headers in the DpsHeaders common library.
Summary - Different stakeholders have their own preferences when it comes to the identity provider (IdP) that a given OSDU instance should use to authenticate the users. Earlier, there was a strong coupling between a specific implementation and the used identity provider (e.g., Google for GCP, AAD for Azure, Cognito for AWS). SLB and MSFT have worked together to remove this from services implementation (on Azure) by extracting it as a common concern of the service mesh.
At the ISTIO level, the user identity will be extracted and will be passed in as a new header (x-user-id, x-app-id).The service mesh (Istio) will guarantee that the x-user-id and x-app-id headers can be trusted by the services by ensuring that the headers are not propagated inward from any external request. Any call received by the services can only have these headers provided by the service mesh filter.
Also, doing this will simplify the internal code as the next step is to refactor and remove any code that deals with JWTs directly to extract the user or app identity.
So in order to support this new header for user identity coming from OSDU, we have added new custom headers "x-user-id" and "x-app-id" in the DpsHeaders common library . We will be using these new headers for the authorization purposes by the entitlements service.
Below is the code which is added to support the headers -
public static final String USER_ID = "x-user-id";
public static final String APP_ID = "x-app-id";
headerKeys.add(USER_ID);
headerKeys.add(APP_ID);
public String getUserId() {
return this.getHeader(USER_ID);
}
public String getAppId() {
return this.getHeader(APP_ID);
}