use of org.apereo.cas.configuration.model.support.mfa.U2FMultifactorProperties in project cas by apereo.
the class U2FMongoDbConfiguration method u2fDeviceRepository.
@Bean
public U2FDeviceRepository u2fDeviceRepository() {
final U2FMultifactorProperties u2f = casProperties.getAuthn().getMfa().getU2f();
final MongoDbConnectionFactory factory = new MongoDbConnectionFactory();
final U2FMultifactorProperties.MongoDb mongoProps = u2f.getMongo();
final MongoTemplate mongoTemplate = factory.buildMongoTemplate(mongoProps);
factory.createCollection(mongoTemplate, mongoProps.getCollection(), mongoProps.isDropCollection());
final LoadingCache<String, String> requestStorage = Caffeine.newBuilder().expireAfterWrite(u2f.getExpireRegistrations(), u2f.getExpireRegistrationsTimeUnit()).build(key -> StringUtils.EMPTY);
final U2FMongoDbDeviceRepository repo = new U2FMongoDbDeviceRepository(requestStorage, mongoTemplate, u2f.getExpireRegistrations(), u2f.getExpireDevicesTimeUnit(), mongoProps.getCollection());
repo.setCipherExecutor(this.u2fRegistrationRecordCipherExecutor);
return repo;
}
use of org.apereo.cas.configuration.model.support.mfa.U2FMultifactorProperties in project cas by apereo.
the class U2FConfiguration method u2fDeviceRepository.
@ConditionalOnMissingBean(name = "u2fDeviceRepository")
@Bean
public U2FDeviceRepository u2fDeviceRepository() {
final U2FMultifactorProperties u2f = casProperties.getAuthn().getMfa().getU2f();
final LoadingCache<String, String> requestStorage = Caffeine.newBuilder().expireAfterWrite(u2f.getExpireDevices(), u2f.getExpireDevicesTimeUnit()).build(key -> StringUtils.EMPTY);
if (u2f.getJson().getLocation() != null) {
return new U2FJsonResourceDeviceRepository(requestStorage, u2f.getJson().getLocation(), u2f.getExpireDevices(), u2f.getExpireDevicesTimeUnit());
}
if (u2f.getGroovy().getLocation() != null) {
return new U2FGroovyResourceDeviceRepository(requestStorage, u2f.getGroovy().getLocation(), u2f.getExpireDevices(), u2f.getExpireDevicesTimeUnit());
}
if (StringUtils.isNotBlank(u2f.getRest().getUrl())) {
return new U2FRestResourceDeviceRepository(requestStorage, u2f.getExpireDevices(), u2f.getExpireDevicesTimeUnit(), u2f.getRest());
}
final LoadingCache<String, Map<String, String>> userStorage = Caffeine.newBuilder().expireAfterWrite(u2f.getExpireDevices(), u2f.getExpireDevicesTimeUnit()).build(key -> new HashMap<>());
return new U2FInMemoryDeviceRepository(userStorage, requestStorage);
}
use of org.apereo.cas.configuration.model.support.mfa.U2FMultifactorProperties in project cas by apereo.
the class U2FJpaConfiguration method u2fDeviceRepository.
@Bean
public U2FDeviceRepository u2fDeviceRepository() {
final U2FMultifactorProperties u2f = casProperties.getAuthn().getMfa().getU2f();
final LoadingCache<String, String> requestStorage = Caffeine.newBuilder().expireAfterWrite(u2f.getExpireRegistrations(), u2f.getExpireRegistrationsTimeUnit()).build(key -> StringUtils.EMPTY);
final U2FJpaDeviceRepository repo = new U2FJpaDeviceRepository(requestStorage, u2f.getExpireRegistrations(), u2f.getExpireDevicesTimeUnit());
repo.setCipherExecutor(this.u2fRegistrationRecordCipherExecutor);
return repo;
}
Aggregations