use of org.apereo.cas.trusted.authentication.storage.InMemoryMultifactorAuthenticationTrustStorage in project cas by apereo.
the class MultifactorAuthnTrustConfiguration method mfaTrustEngine.
@ConditionalOnMissingBean(name = "mfaTrustEngine")
@Bean
@RefreshScope
public MultifactorAuthenticationTrustStorage mfaTrustEngine() {
final TrustedDevicesMultifactorProperties trusted = casProperties.getAuthn().getMfa().getTrusted();
final LoadingCache<String, MultifactorAuthenticationTrustRecord> storage = Caffeine.newBuilder().initialCapacity(INITIAL_CACHE_SIZE).maximumSize(MAX_CACHE_SIZE).expireAfterWrite(trusted.getExpiration(), trusted.getTimeUnit()).build(s -> {
LOGGER.error("Load operation of the cache is not supported.");
return null;
});
storage.asMap();
final BaseMultifactorAuthenticationTrustStorage m;
if (trusted.getJson().getLocation() != null) {
LOGGER.debug("Storing trusted device records inside the JSON resource [{}]", trusted.getJson().getLocation());
m = new JsonMultifactorAuthenticationTrustStorage(trusted.getJson().getLocation());
} else {
LOGGER.warn("Storing trusted device records in runtime memory. Changes and records will be lost upon CAS restarts");
m = new InMemoryMultifactorAuthenticationTrustStorage(storage);
}
m.setCipherExecutor(mfaTrustCipherExecutor());
return m;
}
Aggregations