use of org.apereo.cas.pm.LdapPasswordManagementService in project cas by apereo.
the class LdapPasswordManagementConfiguration method passwordChangeService.
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@Bean
public PasswordManagementService passwordChangeService(final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties, @Qualifier("passwordManagementCipherExecutor") final CipherExecutor passwordManagementCipherExecutor, @Qualifier("passwordHistoryService") final PasswordHistoryService passwordHistoryService) {
return BeanSupplier.of(PasswordManagementService.class).when(CONDITION.given(applicationContext.getEnvironment())).supply(() -> {
val connectionFactoryMap = new ConcurrentHashMap<String, ConnectionFactory>();
val passwordManagerProperties = casProperties.getAuthn().getPm();
passwordManagerProperties.getLdap().forEach(ldap -> connectionFactoryMap.put(ldap.getLdapUrl(), LdapUtils.newLdaptiveConnectionFactory(ldap)));
return new LdapPasswordManagementService(passwordManagementCipherExecutor, casProperties.getServer().getPrefix(), passwordManagerProperties, passwordHistoryService, connectionFactoryMap);
}).otherwise(() -> new NoOpPasswordManagementService(passwordManagementCipherExecutor, casProperties.getServer().getPrefix(), casProperties.getAuthn().getPm())).get();
}
Aggregations