Hello ISAMers,
When trying to access an OAuth protected ressource we inject a http header containing a JWT with useful information for the backend api's.
We are running into a very strange issue that we don't understand at all, and we hope someone will be able to help us understand what is this black magic.
It seems that the first time an access token is used and that the following code is executed in the POSTToken mapping rule the header is correctly inserted:
if (request_type == "resource" && state_id != null) {
trace(IN_TYPE, mapping_rule_name, "resource access, trying to add attributes to STSUU", addOpts);
var cache = IDMappingExtUtils.getIDMappingExtCache();
jwtToken = cache.get(state_id);
trace(LOG_TYPE, mapping_rule_name, "GOT TOKEN FROM CACHE: " + jwtToken, addOpts);
stsuu.addContextAttribute(new Attribute("jwt", "urn:ibm:names:ITFIM:oauth:response:attribute", new String(jwtToken)));
stsuu.addContextAttribute(new Attribute("tagvalue_always",
"urn:ibm:names:ITFIM:oauth:response:attribute", "username,access_token,oauth_token_client_id,authorized,scope,client_type,expires,jwt"));
trace(OUT_TYPE, mapping_rule_name, "resource access, session attributes added STSUU: " + stsuu.toString(), addOpts);
}
The issue we are running into is that when we modify the JWTtoken stored in the IDMappingExtCache the logs show that we retrieve the new JWT value from the cache and that we insert it correctly in the STSUU but webseal is still injecting the previous value of the JWT!
Is there any hidden cache somewhere that makes webseal cache a oauth response attribute for an specific oauth access token ?
Thanks in advance to anyone that could help us understanding what we are doing wrong here.
------------------------------
André Leruitte
------------------------------