T - the custom Principal type to locatepublic class DefaultPrincipalDeterminationStrategy<T extends Principal> extends Object implements Function<org.opensaml.profile.context.ProfileRequestContext,T>
Principal of a particular type found on the
AuthenticationResult returned by
AuthenticationContext.getAuthenticationResult().
The context is located using a lookup strategy, by default a child of the input context.
If for any reason a matching Principal can't be located, a default is returned.
| Modifier and Type | Class and Description |
|---|---|
private class |
DefaultPrincipalDeterminationStrategy.WeightedComparator
A
Comparator that compares the mapped weights of the two operands, using a weight of zero
for any unmapped values. |
| Modifier and Type | Field and Description |
|---|---|
private Function<org.opensaml.profile.context.ProfileRequestContext,AuthenticationContext> |
authnContextLookupStrategy
Authentication context lookup strategy.
|
private T |
defaultPrincipal
Default Principal to return.
|
private Class<T> |
principalType
Type of Principal to return.
|
private Map<T,Integer> |
weightMap
A map supplying weighted preference to particular Principals.
|
| Constructor and Description |
|---|
DefaultPrincipalDeterminationStrategy(Class<T> type,
T principal)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
T |
apply(org.opensaml.profile.context.ProfileRequestContext input) |
void |
setAuthenticationContextLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,AuthenticationContext> strategy)
Set lookup strategy for
AuthenticationContext. |
void |
setWeightMap(Map<T,Integer> map)
Set the map of Principals to weight values to impose a sort order on any matching Principals
found in the authentication result.
|
@Nonnull private final Class<T extends Principal> principalType
@Nonnull private final T extends Principal defaultPrincipal
@Nonnull @NonnullElements private Map<T extends Principal,Integer> weightMap
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,AuthenticationContext> authnContextLookupStrategy
public DefaultPrincipalDeterminationStrategy(@Nonnull@ParameterName(name="type") Class<T> type, @Nonnull@ParameterName(name="principal") T principal)
type - class type for Principal typeprincipal - default Principal to returnpublic void setWeightMap(@Nullable@NonnullElements Map<T,Integer> map)
map - map to setpublic void setAuthenticationContextLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,AuthenticationContext> strategy)
AuthenticationContext.strategy - lookup strategyCopyright © 1999–2017 Shibboleth Consortium. All rights reserved.