@Override
    public OneTimeTokenAccount update(final OneTimeTokenAccount account) {
        return lock.tryLock(() -> {
            try {
                val accounts = readAccountsFromJsonRepository();
                if (accounts.containsKey(account.getUsername().trim().toLowerCase(Locale.ENGLISH))) {
                    val records = accounts.get(account.getUsername().trim().toLowerCase(Locale.ENGLISH));
                    return records.stream()
                        .filter(rec -> rec.getId() == account.getId())
                        .findFirst()
                        .map(act -> {
                            val encoded = encode(account);
                            act.setSecretKey(encoded.getSecretKey());
                            act.setScratchCodes(encoded.getScratchCodes());
                            act.setValidationCode(encoded.getValidationCode());
                            act.setProperties(encoded.getProperties());
                            writeAccountsToJsonRepository(accounts);
                            return encoded;
                        })
                        .orElse(null);
                }
            } catch (final Exception e) {
                LoggingUtils.error(LOGGER, e);
            }
            return null;
        });
    }
This is {@link JsonGoogleAuthenticatorTokenCredentialRepository}.

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