Search in sources :

Example 1 with GAuthMultifactorProperties

use of org.apereo.cas.configuration.model.support.mfa.GAuthMultifactorProperties in project cas by apereo.

the class GoogleAuthenticatorAuthenticationEventExecutionPlanConfiguration method googleAuthenticatorAuthenticationProvider.

@Bean
@RefreshScope
public MultifactorAuthenticationProvider googleAuthenticatorAuthenticationProvider() {
    final GAuthMultifactorProperties gauth = casProperties.getAuthn().getMfa().getGauth();
    final GoogleAuthenticatorMultifactorAuthenticationProvider p = new GoogleAuthenticatorMultifactorAuthenticationProvider();
    p.setBypassEvaluator(googleBypassEvaluator());
    p.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
    p.setOrder(gauth.getRank());
    p.setId(gauth.getId());
    return p;
}
Also used : GoogleAuthenticatorMultifactorAuthenticationProvider(org.apereo.cas.adaptors.gauth.GoogleAuthenticatorMultifactorAuthenticationProvider) GAuthMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.GAuthMultifactorProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with GAuthMultifactorProperties

use of org.apereo.cas.configuration.model.support.mfa.GAuthMultifactorProperties in project cas by apereo.

the class GoogleAuthenticatorAuthenticationEventExecutionPlanConfiguration method googleAuthenticatorInstance.

@Bean
public IGoogleAuthenticator googleAuthenticatorInstance() {
    final GAuthMultifactorProperties gauth = casProperties.getAuthn().getMfa().getGauth();
    final GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder bldr = new GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder();
    bldr.setCodeDigits(gauth.getCodeDigits());
    bldr.setTimeStepSizeInMillis(TimeUnit.SECONDS.toMillis(gauth.getTimeStepSize()));
    bldr.setWindowSize(gauth.getWindowSize());
    bldr.setKeyRepresentation(KeyRepresentation.BASE32);
    return new GoogleAuthenticator(bldr.build());
}
Also used : IGoogleAuthenticator(com.warrenstrange.googleauth.IGoogleAuthenticator) GoogleAuthenticator(com.warrenstrange.googleauth.GoogleAuthenticator) GoogleAuthenticatorConfig(com.warrenstrange.googleauth.GoogleAuthenticatorConfig) GAuthMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.GAuthMultifactorProperties) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

GAuthMultifactorProperties (org.apereo.cas.configuration.model.support.mfa.GAuthMultifactorProperties)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 Bean (org.springframework.context.annotation.Bean)2 GoogleAuthenticator (com.warrenstrange.googleauth.GoogleAuthenticator)1 GoogleAuthenticatorConfig (com.warrenstrange.googleauth.GoogleAuthenticatorConfig)1 IGoogleAuthenticator (com.warrenstrange.googleauth.IGoogleAuthenticator)1 GoogleAuthenticatorMultifactorAuthenticationProvider (org.apereo.cas.adaptors.gauth.GoogleAuthenticatorMultifactorAuthenticationProvider)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1