use of org.pac4j.couch.profile.service.CouchProfileService in project cas by apereo.
the class CouchDbAuthenticationConfiguration method couchDbAuthenticatorProfileService.
@ConditionalOnMissingBean(name = "couchDbAuthenticatorProfileService")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public CouchProfileService couchDbAuthenticatorProfileService(@Qualifier("authenticationCouchDbFactory") final CouchDbConnectorFactory authenticationCouchDbFactory, final CasConfigurationProperties casProperties, final ConfigurableApplicationContext applicationContext) {
val couchDb = casProperties.getAuthn().getCouchDb();
LOGGER.info("Connected to CouchDb instance @ [{}] using database [{}]", couchDb.getUrl(), couchDb.getDbName());
val encoder = new SpringSecurityPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(couchDb.getPasswordEncoder(), applicationContext));
val auth = new CouchProfileService(authenticationCouchDbFactory.getCouchDbConnector(), couchDb.getAttributes());
auth.setUsernameAttribute(couchDb.getUsernameAttribute());
auth.setPasswordAttribute(couchDb.getPasswordAttribute());
auth.setPasswordEncoder(encoder);
return auth;
}
Aggregations