Make AccountState an AutoValue
AccountState is a cached entity that is shared between different threads. We therefore want it to be immutable. AutoValue is the preferred way of generating immutable entities that have equals and toString implementations and is used for almost all other caches. Hence, we use it for AccountState too. Change-Id: I3b19ef34791c8800667fdcf9ad8beade8539af13
This commit is contained in:
@@ -152,7 +152,7 @@ class ProjectOAuthFilter implements Filter {
|
||||
}
|
||||
|
||||
Optional<AccountState> who =
|
||||
accountCache.getByUsername(authInfo.username).filter(a -> a.getAccount().isActive());
|
||||
accountCache.getByUsername(authInfo.username).filter(a -> a.account().isActive());
|
||||
if (!who.isPresent()) {
|
||||
logger.atWarning().log(
|
||||
authenticationFailedMsg(authInfo.username, req)
|
||||
@@ -161,7 +161,7 @@ class ProjectOAuthFilter implements Filter {
|
||||
return false;
|
||||
}
|
||||
|
||||
Account account = who.get().getAccount();
|
||||
Account account = who.get().account();
|
||||
AuthRequest authRequest = AuthRequest.forExternalUser(authInfo.username);
|
||||
authRequest.setEmailAddress(account.preferredEmail());
|
||||
authRequest.setDisplayName(account.fullName());
|
||||
|
Reference in New Issue
Block a user