use of org.apereo.cas.authentication.PrincipalElectionStrategy in project cas by apereo.
the class ChainingPrincipalElectionStrategy method nominate.
@Override
public Principal nominate(final Collection<Authentication> authentications, final Map<String, List<Object>> principalAttributes) {
val principal = this.chain.stream().sorted(Comparator.comparing(PrincipalElectionStrategy::getOrder)).map(strategy -> strategy.nominate(authentications, principalAttributes)).filter(Objects::nonNull).findFirst().orElseThrow();
LOGGER.trace("Nominated principal [{}] from authentication chain [{}]", principal, authentications);
return principal;
}
use of org.apereo.cas.authentication.PrincipalElectionStrategy in project cas by apereo.
the class ChainingPrincipalElectionStrategy method nominate.
@Override
public Principal nominate(final List<Principal> principals, final Map<String, List<Object>> attributes) {
val principal = this.chain.stream().sorted(Comparator.comparing(PrincipalElectionStrategy::getOrder)).map(strategy -> strategy.nominate(principals, attributes)).findFirst().orElseThrow();
LOGGER.trace("Nominated principal [{}] from principal chain [{}]", principal, principals);
return principal;
}
Aggregations