Search in sources :

Example 1 with AuthenticationRequestRiskCalculator

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);
}
Also used : RiskBasedAuthenticationProperties(org.apereo.cas.configuration.model.core.authentication.RiskBasedAuthenticationProperties) DefaultAuthenticationRiskEvaluator(org.apereo.cas.impl.engine.DefaultAuthenticationRiskEvaluator) UserAgentAuthenticationRequestRiskCalculator(org.apereo.cas.impl.calcs.UserAgentAuthenticationRequestRiskCalculator) IpAddressAuthenticationRequestRiskCalculator(org.apereo.cas.impl.calcs.IpAddressAuthenticationRequestRiskCalculator) DateTimeAuthenticationRequestRiskCalculator(org.apereo.cas.impl.calcs.DateTimeAuthenticationRequestRiskCalculator) GeoLocationAuthenticationRequestRiskCalculator(org.apereo.cas.impl.calcs.GeoLocationAuthenticationRequestRiskCalculator) AuthenticationRequestRiskCalculator(org.apereo.cas.api.AuthenticationRequestRiskCalculator) HashSet(java.util.HashSet) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

HashSet (java.util.HashSet)1 AuthenticationRequestRiskCalculator (org.apereo.cas.api.AuthenticationRequestRiskCalculator)1 RiskBasedAuthenticationProperties (org.apereo.cas.configuration.model.core.authentication.RiskBasedAuthenticationProperties)1 DateTimeAuthenticationRequestRiskCalculator (org.apereo.cas.impl.calcs.DateTimeAuthenticationRequestRiskCalculator)1 GeoLocationAuthenticationRequestRiskCalculator (org.apereo.cas.impl.calcs.GeoLocationAuthenticationRequestRiskCalculator)1 IpAddressAuthenticationRequestRiskCalculator (org.apereo.cas.impl.calcs.IpAddressAuthenticationRequestRiskCalculator)1 UserAgentAuthenticationRequestRiskCalculator (org.apereo.cas.impl.calcs.UserAgentAuthenticationRequestRiskCalculator)1 DefaultAuthenticationRiskEvaluator (org.apereo.cas.impl.engine.DefaultAuthenticationRiskEvaluator)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1