Hi Che colleagues,
As part of SAP DI Development , we need to interfere with che outgoing requests
and replace the user token on the outgoing request with a dynamically generated token based on the url sent to.
We are working with Che 3.14 (soon upgrade to 3.15) currently and would like to contribute a change .
There are several use cases that we need this for .
One use case for example is :
When "Build Request " is sent , che sends a "check builder available" call and request the Auth token from the Context User.
(Triggers from BuidQueue.start() -> server.isAvailable() -> requestString ->User.getToken() )
In our use case , we need to identify to which url the message is sent to and give the appropriate token .
This token is dynamically generated according to the url and cannot be set before .
For that we thought to replace the requests to user.getToken() with user.getTokenByUrl(url).
The default of user.getTokenByURL(String url) will behave the same as before and return getToken()
Code change example :
In HttpJsonHelper.java :
private String getAuthenticationToken(String url) {
390
User user = EnvironmentContext.getCurrent().getUser();
391
if (user != null) {
392
return user.getTokenByUrl(url);
393
}
394
return null;
395
}
Will you consider to merge this to 3.15 ? do you have a good different suggestion ?
Thanks & Regards,
Meirav Daniel