Principal Election
Each step or branch in the CAS authentication flow may decide to produce an authenticated subject (principal) with attributes
and/or collect attributes and metadata about the authentication event itself. These objects or subjects are eventually
collected and assembled into one canonical authentication object that represents a combination of all attempts, with
all data and attributes merged into a single container. You can of course override the merging strategy by registering
your own IAttributeMerger
component with the runtime context:
1
2
3
4
@Bean
public IAttributeMerger principalElectionAttributeMerger() {
return new MyIAttributeMerger();
}
You may also override the entire sequence of principal selection and election by registering
your own PrincipalElectionStrategy
component with the runtime context:
1
2
3
4
@Bean
public PrincipalElectionStrategy principalElectionStrategy() {
return new MyPrincipalElectionStrategy();
}
In the event that the chain of CAS authentication attempts produces multiple subjects with variable, conflicting, distinct identifiers, there needs to be a strategy defined so CAS may be able to determine which principal identifier and object to choose as the basis for the overall authentication attempt at the time of single sign-on.
1
2
3
4
@Bean
public PrincipalElectionStrategyConflictResolver defaultPrincipalElectionStrategyConflictResolver() {
return new MyPrincipalElectionStrategyConflictResolver();
}

See this guide to learn more about how to register configurations into the CAS runtime.