Search in sources :

Example 1 with AzureMultifactorProperties

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

the class AzureAuthenticatorAuthenticationEventExecutionPlanConfiguration method azureAuthenticatorAuthenticationProvider.

@Bean
@RefreshScope
public MultifactorAuthenticationProvider azureAuthenticatorAuthenticationProvider() {
    final AzureMultifactorProperties azure = casProperties.getAuthn().getMfa().getAzure();
    final AzureAuthenticatorMultifactorAuthenticationProvider p = new AzureAuthenticatorMultifactorAuthenticationProvider();
    p.setBypassEvaluator(azureBypassEvaluator());
    p.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
    p.setOrder(azure.getRank());
    p.setId(azure.getId());
    return p;
}
Also used : AzureAuthenticatorMultifactorAuthenticationProvider(org.apereo.cas.adaptors.azure.AzureAuthenticatorMultifactorAuthenticationProvider) AzureMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.AzureMultifactorProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with AzureMultifactorProperties

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

the class AzureAuthenticatorAuthenticationEventExecutionPlanConfiguration method azureAuthenticatorInstance.

@Bean
@SneakyThrows
public PFAuth azureAuthenticatorInstance() {
    final AzureMultifactorProperties azure = casProperties.getAuthn().getMfa().getAzure();
    final File cfg = new File(azure.getConfigDir());
    if (!cfg.exists() || !cfg.isDirectory()) {
        throw new FileNotFoundException(cfg.getAbsolutePath() + " does not exist or is not a directory");
    }
    final PFAuth pf = new PFAuth();
    pf.setDebug(true);
    pf.setAllowInternationalCalls(azure.isAllowInternationalCalls());
    final String dir = StringUtils.appendIfMissing(azure.getConfigDir(), "/");
    pf.initialize(dir, azure.getPrivateKeyPassword());
    return pf;
}
Also used : PFAuth(net.phonefactor.pfsdk.PFAuth) FileNotFoundException(java.io.FileNotFoundException) AzureMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.AzureMultifactorProperties) File(java.io.File) SneakyThrows(lombok.SneakyThrows) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

AzureMultifactorProperties (org.apereo.cas.configuration.model.support.mfa.AzureMultifactorProperties)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 Bean (org.springframework.context.annotation.Bean)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 SneakyThrows (lombok.SneakyThrows)1 PFAuth (net.phonefactor.pfsdk.PFAuth)1 AzureAuthenticatorMultifactorAuthenticationProvider (org.apereo.cas.adaptors.azure.AzureAuthenticatorMultifactorAuthenticationProvider)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1