use of org.apereo.cas.adaptors.u2f.storage.U2FMongoDbDeviceRepository 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.adaptors.u2f.storage.U2FMongoDbDeviceRepository in project cas by apereo.
the class U2FMongoDbConfiguration method u2fDeviceRepository.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public U2FDeviceRepository u2fDeviceRepository(final CasConfigurationProperties casProperties, @Qualifier("u2fRegistrationRecordCipherExecutor") final CipherExecutor u2fRegistrationRecordCipherExecutor, @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext) {
val u2f = casProperties.getAuthn().getMfa().getU2f();
val factory = new MongoDbConnectionFactory(casSslContext.getSslContext());
val mongoProps = u2f.getMongo();
val mongoTemplate = factory.buildMongoTemplate(mongoProps);
MongoDbConnectionFactory.createCollection(mongoTemplate, mongoProps.getCollection(), mongoProps.isDropCollection());
final LoadingCache<String, String> requestStorage = Caffeine.newBuilder().expireAfterWrite(u2f.getCore().getExpireRegistrations(), u2f.getCore().getExpireRegistrationsTimeUnit()).build(key -> StringUtils.EMPTY);
return new U2FMongoDbDeviceRepository(requestStorage, mongoTemplate, u2fRegistrationRecordCipherExecutor, casProperties);
}
Aggregations