IdmIdentityService.updateAuthorityChange should be thread-safe
The method updateAuthorityChange is not thread-safe. When called multiple times at the same time for the same identities, it could happen that some identity would be stored in the AuthChangeRepository multiple times. That would cause exceptions during authentization of this identity (wouldn't be able to authenticate).
(It happened to me when I tried to use this method in auth filter, so it was called several times parallel for the same user. The only fix was to clear idm_authority_change table in DB.)
Also the method shouldn't change the input parameter "identities" - the programmer doesn't expect it :-)
Updated by Jan Helbich over 4 years ago
- Assignee changed from Jan Helbich to Radek Tomiška
The method has been refactored while working on some other issue and behaves correctly now.
Unfortunately I could not reproduce the thread-unsafe issue.
I propose an addion of unique constraint onto the idm_authority_change table#identity.