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;
}
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;
}
Aggregations