@Override
    public OneTimeTokenAccount save(final OneTimeTokenAccount account) {
        return lock.tryLock(() -> {
            try {
                account.assignIdIfNecessary();
                LOGGER.debug("Storing google authenticator account for [{}]", account.getUsername());
                val accounts = readAccountsFromJsonRepository();
                LOGGER.debug("Found [{}] account(s) and added google authenticator account for [{}]",
                    accounts.size(), account.getUsername());
                val encoded = encode(account);
                val records = accounts.getOrDefault(account.getUsername().trim().toLowerCase(Locale.ENGLISH), new ArrayList<>());
                records.add(encoded);
                accounts.put(account.getUsername().trim().toLowerCase(Locale.ENGLISH), records);
                writeAccountsToJsonRepository(accounts);
                return encoded;
            } 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