use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class ElectronicFenceConfiguration method authenticationRiskEvaluator.
@ConditionalOnMissingBean(name = "authenticationRiskEvaluator")
@Bean
@RefreshScope
public AuthenticationRiskEvaluator authenticationRiskEvaluator() {
final RiskBasedAuthenticationProperties risk = casProperties.getAuthn().getAdaptive().getRisk();
final Set<AuthenticationRequestRiskCalculator> calculators = new HashSet<>();
if (risk.getIp().isEnabled()) {
calculators.add(ipAddressAuthenticationRequestRiskCalculator());
}
if (risk.getAgent().isEnabled()) {
calculators.add(userAgentAuthenticationRequestRiskCalculator());
}
if (risk.getDateTime().isEnabled()) {
calculators.add(dateTimeAuthenticationRequestRiskCalculator());
}
if (risk.getGeoLocation().isEnabled()) {
calculators.add(geoLocationAuthenticationRequestRiskCalculator());
}
if (calculators.isEmpty()) {
LOGGER.warn("No risk calculators are defined to examine authentication requests");
}
return new DefaultAuthenticationRiskEvaluator(calculators);
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class ElectronicFenceConfiguration method blockAuthenticationContingencyPlan.
@ConditionalOnMissingBean(name = "blockAuthenticationContingencyPlan")
@Bean
@RefreshScope
public AuthenticationRiskContingencyPlan blockAuthenticationContingencyPlan() {
final BlockAuthenticationContingencyPlan b = new BlockAuthenticationContingencyPlan();
configureContingencyPlan(b);
return b;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class GrouperMultifactorAuthenticationConfiguration method grouperMultifactorAuthenticationWebflowEventResolver.
@Bean
@RefreshScope
public CasWebflowEventResolver grouperMultifactorAuthenticationWebflowEventResolver() {
final AbstractCasWebflowEventResolver r;
if (StringUtils.isNotBlank(casProperties.getAuthn().getMfa().getGrouperGroupField())) {
r = new GrouperMultifactorAuthenticationPolicyEventResolver(authenticationSystemSupport, centralAuthenticationService, servicesManager, ticketRegistrySupport, warnCookieGenerator, authenticationRequestServiceSelectionStrategies, multifactorAuthenticationProviderSelector, casProperties);
LOGGER.debug("Activating MFA event resolver based on Grouper groups...");
} else {
r = new NoOpCasWebflowEventResolver(authenticationSystemSupport, centralAuthenticationService, servicesManager, ticketRegistrySupport, warnCookieGenerator, authenticationRequestServiceSelectionStrategies, multifactorAuthenticationProviderSelector);
}
return r;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class LdapServiceRegistryConfiguration method serviceRegistryDao.
@Bean
@RefreshScope
@Autowired
public ServiceRegistryDao serviceRegistryDao(@Qualifier("ldapServiceRegistryMapper") final LdapRegisteredServiceMapper mapper) {
final LdapServiceRegistryProperties ldap = casProperties.getServiceRegistry().getLdap();
final ConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(ldap);
return new LdapServiceRegistryDao(connectionFactory, ldap.getBaseDn(), mapper, ldap);
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class RejectUsersAuthenticationEventExecutionPlanConfiguration method rejectUsersAuthenticationHandler.
@RefreshScope
@Bean
public AuthenticationHandler rejectUsersAuthenticationHandler() {
final RejectAuthenticationProperties rejectProperties = casProperties.getAuthn().getReject();
final Set<String> users = org.springframework.util.StringUtils.commaDelimitedListToSet(rejectProperties.getUsers());
final RejectUsersAuthenticationHandler h = new RejectUsersAuthenticationHandler(rejectProperties.getName(), servicesManager, rejectUsersPrincipalFactory(), users);
h.setPasswordEncoder(Beans.newPasswordEncoder(rejectProperties.getPasswordEncoder()));
if (rejectPasswordPolicyConfiguration != null) {
h.setPasswordPolicyConfiguration(rejectPasswordPolicyConfiguration);
}
h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(rejectProperties.getPrincipalTransformation()));
return h;
}
Aggregations