Fix eviction order when linking new external ids

When an account is linked to another external id at login, the cache
invalidation was made too early and the cache and index were reloaded
with a stale entry.

This would have impacted users linking other external ids
that ended up having an inconsistent cache state:
- accounts by id were correct, because external ids where loaded from DB
- accounts by name were stale, because external ids where loaded from index

With this fix, all the caches are consistent and the reindex happens
at the right time, when the new external ids has been linked.

Bug: Issue 5055
Change-Id: I9ca07d10597db482d8a0d0cb4ce19f99ddc19b10
(cherry picked from commit 96e0d7fd8b)
This commit is contained in:
Luca Milanesio
2016-12-03 23:43:55 +00:00
committed by Paladox none
parent 9eb3b2fd86
commit dedd974d4b

View File

@@ -406,8 +406,8 @@ public class AccountManager {
if (who.getEmailAddress() != null) {
byEmailCache.evict(who.getEmailAddress());
byIdCache.evict(to);
}
byIdCache.evict(to);
}
return new AuthResult(to, key, false);