@Override public Set<MultifactorAuthenticationTrustRecord> get( final String principal, final LocalDate onOrAfterDate) { final Set<MultifactorAuthenticationTrustRecord> res = get(principal); res.removeIf( entry -> { if (entry.getDate().isBefore(onOrAfterDate)) { return true; } final String decodedKey = this.cipherExecutor.decode(entry.getKey()); final String currentKey = MultifactorAuthenticationTrustUtils.generateKey(entry); if (StringUtils.isBlank(decodedKey)) { return true; } if (!decodedKey.equals(currentKey)) { return true; } return false; }); return res; }
/** * Generate key . * * @param r the record * @return the string */ protected String generateKey(final MultifactorAuthenticationTrustRecord r) { return cipherExecutor.encode(MultifactorAuthenticationTrustUtils.generateKey(r)); }