use of org.apereo.cas.support.wsfederation.authentication.principal.WsFederationCredentialsToPrincipalResolver in project cas by apereo.
the class WsFedAuthenticationEventExecutionPlanConfiguration method adfsPrincipalResolver.
@Bean
@RefreshScope
public PrincipalResolver adfsPrincipalResolver() {
final WsFederationDelegationProperties wsfed = casProperties.getAuthn().getWsfed();
final WsFederationCredentialsToPrincipalResolver r = new WsFederationCredentialsToPrincipalResolver();
r.setConfiguration(wsFedConfig());
r.setAttributeRepository(attributeRepository);
r.setPrincipalAttributeName(wsfed.getPrincipal().getPrincipalAttribute());
r.setReturnNullIfNoAttributes(wsfed.getPrincipal().isReturnNull());
r.setPrincipalFactory(adfsPrincipalFactory());
return r;
}
use of org.apereo.cas.support.wsfederation.authentication.principal.WsFederationCredentialsToPrincipalResolver in project cas by apereo.
the class WsFedAuthenticationEventExecutionPlanConfiguration method wsfedAuthenticationEventExecutionPlanConfigurer.
@ConditionalOnMissingBean(name = "wsfedAuthenticationEventExecutionPlanConfigurer")
@Bean
public AuthenticationEventExecutionPlanConfigurer wsfedAuthenticationEventExecutionPlanConfigurer() {
return plan -> casProperties.getAuthn().getWsfed().stream().filter(wsfed -> StringUtils.isNotBlank(wsfed.getIdentityProviderUrl()) && StringUtils.isNotBlank(wsfed.getIdentityProviderIdentifier())).forEach(wsfed -> {
final AuthenticationHandler handler = new WsFederationAuthenticationHandler(wsfed.getName(), servicesManager, adfsPrincipalFactory());
if (!wsfed.isAttributeResolverEnabled()) {
plan.registerAuthenticationHandler(handler);
} else {
final WsFederationCredentialsToPrincipalResolver r = new WsFederationCredentialsToPrincipalResolver(attributeRepository, adfsPrincipalFactory(), wsfed.getPrincipal().isReturnNull(), wsfed.getPrincipal().getPrincipalAttribute(), getWsFederationConfiguration(wsfed));
plan.registerAuthenticationHandlerWithPrincipalResolver(handler, r);
}
});
}
Aggregations