Search in sources :

Example 1 with JsonResourceAuthenticationHandler

use of org.apereo.cas.adaptors.generic.JsonResourceAuthenticationHandler in project cas by apereo.

the class JsonResourceAuthenticationEventExecutionPlanConfiguration method jsonResourceAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler jsonResourceAuthenticationHandler() {
    final JsonResourceAuthenticationProperties jsonProps = casProperties.getAuthn().getJson();
    final JsonResourceAuthenticationHandler h = new JsonResourceAuthenticationHandler(jsonProps.getName(), servicesManager, jsonPrincipalFactory(), null, jsonProps.getLocation());
    h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(jsonProps.getPasswordEncoder()));
    if (jsonProps.getPasswordPolicy().isEnabled()) {
        h.setPasswordPolicyConfiguration(new PasswordPolicyConfiguration(jsonProps.getPasswordPolicy()));
    }
    h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(jsonProps.getPrincipalTransformation()));
    return h;
}
Also used : JsonResourceAuthenticationHandler(org.apereo.cas.adaptors.generic.JsonResourceAuthenticationHandler) PasswordPolicyConfiguration(org.apereo.cas.authentication.support.password.PasswordPolicyConfiguration) JsonResourceAuthenticationProperties(org.apereo.cas.configuration.model.support.generic.JsonResourceAuthenticationProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with JsonResourceAuthenticationHandler

use of org.apereo.cas.adaptors.generic.JsonResourceAuthenticationHandler in project cas by apereo.

the class JsonResourceAuthenticationEventExecutionPlanConfiguration method jsonResourceAuthenticationHandler.

@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@Bean
public AuthenticationHandler jsonResourceAuthenticationHandler(final CasConfigurationProperties casProperties, final ConfigurableApplicationContext applicationContext, @Qualifier("jsonPrincipalFactory") final PrincipalFactory jsonPrincipalFactory, @Qualifier(ServicesManager.BEAN_NAME) final ServicesManager servicesManager) {
    val jsonProps = casProperties.getAuthn().getJson();
    val h = new JsonResourceAuthenticationHandler(jsonProps.getName(), servicesManager, jsonPrincipalFactory, null, jsonProps.getLocation());
    h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(jsonProps.getPasswordEncoder(), applicationContext));
    if (jsonProps.getPasswordPolicy().isEnabled()) {
        h.setPasswordPolicyConfiguration(new PasswordPolicyContext(jsonProps.getPasswordPolicy()));
    }
    h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(jsonProps.getPrincipalTransformation()));
    h.setState(jsonProps.getState());
    return h;
}
Also used : lombok.val(lombok.val) JsonResourceAuthenticationHandler(org.apereo.cas.adaptors.generic.JsonResourceAuthenticationHandler) PasswordPolicyContext(org.apereo.cas.authentication.support.password.PasswordPolicyContext) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

JsonResourceAuthenticationHandler (org.apereo.cas.adaptors.generic.JsonResourceAuthenticationHandler)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)2 Bean (org.springframework.context.annotation.Bean)2 lombok.val (lombok.val)1 PasswordPolicyConfiguration (org.apereo.cas.authentication.support.password.PasswordPolicyConfiguration)1 PasswordPolicyContext (org.apereo.cas.authentication.support.password.PasswordPolicyContext)1 JsonResourceAuthenticationProperties (org.apereo.cas.configuration.model.support.generic.JsonResourceAuthenticationProperties)1