use of org.apereo.cas.api.AuthenticationRequestRiskCalculator 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);
}
Aggregations