Bug with userInfo?

Hello there, I’m new in camunda so i’ma trying to build a POC to discover its potential.

For this poc, I try to log a user to a webservice, get the token that webservice send me and store the token in my user “properties”.

So I try to use the userInfo feature of IdentityService, as it allow to store a key/value data.

I proceed like this:

IdentityService identityService = delegateExecution.getProcessEngineServices().getIdentityService();

String currentUser = identityService.getCurrentAuthentication().getUserId();
identityService.setUserInfo(currentUser, "token", myToken);
System.out.println("User keys: " + identityService.getUserInfoKeys(currentUser));
System.out.println("token: " + identityService.getUserInfo(currentUser, "token"));

And it return… nothing:

User keys: []
token: null

So it’s not saving my “token” userInfo… is something wrong with my code? Should I do more?

It seems the issue is in the IdentityInfoManager class, where the setUserInfo method call the getDbEntityManager.insert() function, but nothing is saved. No error message though…

Ok problem solve.

Actually, transactions are only committed on wait states, so my new “token” parameter was saved, but only in cache, and was accessible after my service finished…