use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasPersonDirectoryConfiguration method ldapAttributeRepositories.
@ConditionalOnMissingBean(name = "ldapAttributeRepositories")
@Bean
@RefreshScope
public List<IPersonAttributeDao> ldapAttributeRepositories() {
final List<IPersonAttributeDao> list = new ArrayList<>();
final PrincipalAttributesProperties attrs = casProperties.getAuthn().getAttributeRepository();
attrs.getLdap().forEach(ldap -> {
if (StringUtils.isNotBlank(ldap.getBaseDn()) && StringUtils.isNotBlank(ldap.getLdapUrl())) {
final LdaptivePersonAttributeDao ldapDao = new LdaptivePersonAttributeDao();
LOGGER.debug("Configured LDAP attribute source for [{}] and baseDn [{}]", ldap.getLdapUrl(), ldap.getBaseDn());
ldapDao.setConnectionFactory(Beans.newLdaptivePooledConnectionFactory(ldap));
ldapDao.setBaseDN(ldap.getBaseDn());
LOGGER.debug("LDAP attributes are fetched from [{}] via filter [{}]", ldap.getLdapUrl(), ldap.getUserFilter());
ldapDao.setSearchFilter(ldap.getUserFilter());
final SearchControls constraints = new SearchControls();
if (ldap.getAttributes() != null && !ldap.getAttributes().isEmpty()) {
LOGGER.debug("Configured result attribute mapping for [{}] to be [{}]", ldap.getLdapUrl(), ldap.getAttributes());
ldapDao.setResultAttributeMapping(ldap.getAttributes());
final String[] attributes = ldap.getAttributes().keySet().toArray(new String[ldap.getAttributes().keySet().size()]);
constraints.setReturningAttributes(attributes);
} else {
LOGGER.debug("Retrieving all attributes as no explicit attribute mappings are defined for [{}]", ldap.getLdapUrl());
constraints.setReturningAttributes(null);
}
if (ldap.isSubtreeSearch()) {
LOGGER.debug("Configured subtree searching for [{}]", ldap.getLdapUrl());
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
}
constraints.setDerefLinkFlag(true);
ldapDao.setSearchControls(constraints);
ldapDao.setOrder(ldap.getOrder());
LOGGER.debug("Initializing LDAP attribute source for [{}]", ldap.getLdapUrl());
ldapDao.initialize();
list.add(ldapDao);
}
});
return list;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCoreAuthenticationHandlersConfiguration method acceptUsersAuthenticationHandler.
@RefreshScope
@Bean
public AuthenticationHandler acceptUsersAuthenticationHandler() {
final AcceptAuthenticationProperties acceptAuthenticationProperties = casProperties.getAuthn().getAccept();
final HashMap<String, String> users = new HashMap<>();
final AcceptUsersAuthenticationHandler h = new AcceptUsersAuthenticationHandler(acceptAuthenticationProperties.getName(), servicesManager, acceptUsersPrincipalFactory(), null, users);
h.setUsers(getParsedUsers());
h.setPasswordEncoder(Beans.newPasswordEncoder(acceptAuthenticationProperties.getPasswordEncoder()));
if (acceptPasswordPolicyConfiguration != null) {
h.setPasswordPolicyConfiguration(acceptPasswordPolicyConfiguration);
}
h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(acceptAuthenticationProperties.getPrincipalTransformation()));
return h;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCoreWebflowConfiguration method initialAuthenticationAttemptWebflowEventResolver.
@ConditionalOnMissingBean(name = "initialAuthenticationAttemptWebflowEventResolver")
@Bean
@RefreshScope
public CasDelegatingWebflowEventResolver initialAuthenticationAttemptWebflowEventResolver() {
final InitialAuthenticationAttemptWebflowEventResolver r = new InitialAuthenticationAttemptWebflowEventResolver(authenticationSystemSupport, centralAuthenticationService, servicesManager, ticketRegistrySupport, warnCookieGenerator, authenticationRequestServiceSelectionStrategies, selector);
r.addDelegate(adaptiveAuthenticationPolicyWebflowEventResolver());
r.addDelegate(globalAuthenticationPolicyWebflowEventResolver());
r.addDelegate(requestParameterAuthenticationPolicyWebflowEventResolver());
r.addDelegate(restEndpointAuthenticationPolicyWebflowEventResolver());
r.addDelegate(registeredServicePrincipalAttributeAuthenticationPolicyWebflowEventResolver());
r.addDelegate(principalAttributeAuthenticationPolicyWebflowEventResolver());
r.addDelegate(authenticationAttributeAuthenticationPolicyWebflowEventResolver());
r.addDelegate(registeredServiceAuthenticationPolicyWebflowEventResolver());
r.setSelectiveResolver(selectiveAuthenticationProviderWebflowEventResolver());
return r;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCoreWebConfiguration method messageSource.
@RefreshScope
@Bean
public AbstractResourceBasedMessageSource messageSource() {
final CasReloadableMessageBundle bean = new CasReloadableMessageBundle();
bean.setDefaultEncoding(casProperties.getMessageBundle().getEncoding());
bean.setCacheSeconds(casProperties.getMessageBundle().getCacheSeconds());
bean.setFallbackToSystemLocale(casProperties.getMessageBundle().isFallbackSystemLocale());
bean.setUseCodeAsDefaultMessage(casProperties.getMessageBundle().isUseCodeMessage());
bean.setBasenames(casProperties.getMessageBundle().getBaseNames());
return bean;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class AuthyAuthenticationEventExecutionPlanConfiguration method authyAuthenticatorAuthenticationProvider.
@Bean
@RefreshScope
public MultifactorAuthenticationProvider authyAuthenticatorAuthenticationProvider() {
final AuthyMultifactorAuthenticationProvider p = new AuthyMultifactorAuthenticationProvider();
p.setBypassEvaluator(authyBypassEvaluator());
p.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
p.setOrder(casProperties.getAuthn().getMfa().getAuthy().getRank());
p.setId(casProperties.getAuthn().getMfa().getAuthy().getId());
return p;
}
Aggregations