@Override
    public OneTimeTokenAccount update(final OneTimeTokenAccount account) {
        return lock.tryLock(() -> {
            val encoded = encode(account);
            if (accounts.containsKey(account.getUsername().toLowerCase(Locale.ENGLISH).trim())) {
                val records = accounts.get(account.getUsername().toLowerCase(Locale.ENGLISH).trim());
                records.stream()
                    .filter(rec -> rec.getId() == account.getId())
                    .findFirst()
                    .ifPresent(act -> {
                        act.setSecretKey(account.getSecretKey());
                        act.setScratchCodes(account.getScratchCodes());
                        act.setValidationCode(account.getValidationCode());
                        act.setProperties(account.getProperties());
                    });
            }
            return encoded;
        });
    }
This is {@link InMemoryGoogleAuthenticatorTokenCredentialRepository}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-gauth-core/src/main/java/org/apereo/cas/gauth/credential/InMemoryGoogleAuthenticatorTokenCredentialRepository.java