T - the custom Principal type to locatepublic class DefaultPrincipalDeterminationStrategy<T extends Principal> extends Object implements com.google.common.base.Function<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 com.google.common.base.Function<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(ProfileRequestContext input) |
void |
setAuthenticationContextLookupStrategy(com.google.common.base.Function<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 com.google.common.base.Function<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 com.google.common.base.Function<ProfileRequestContext,AuthenticationContext> strategy)
AuthenticationContext.strategy - lookup strategy@Nullable public T apply(@Nullable ProfileRequestContext input)
apply in interface com.google.common.base.Function<ProfileRequestContext,T extends Principal>Copyright © 1999–2018 Shibboleth Consortium. All rights reserved.