default String serializeKey() { String userId = getUserId(); String encodedUserId = userId == null ? "" : Base64.encodeBytes(userId.getBytes(StandardCharsets.UTF_8)); return String.format("%s.%d.%s.%s", encodedUserId, getExpiration(), getActionVerificationNonce(), getActionId()); } }
@Override public void put(ActionTokenKeyModel key, Map<String, String> notes) { if (key == null || key.getUserId() == null || key.getActionId() == null) { return; } ActionTokenReducedKey tokenKey = new ActionTokenReducedKey(key.getUserId(), key.getActionId(), key.getActionVerificationNonce()); ActionTokenValueEntity tokenValue = new ActionTokenValueEntity(notes); LOG.debugf("Adding used action token to actionTokens cache: %s", tokenKey.toString()); this.tx.put(actionKeyCache, tokenKey, tokenValue, key.getExpiration() - Time.currentTime(), TimeUnit.SECONDS); }