Class DefaultPrincipalDeterminationStrategy<T extends Principal>
- java.lang.Object
-
- net.shibboleth.idp.authn.principal.DefaultPrincipalDeterminationStrategy<T>
-
- Type Parameters:
T
- the custom Principal type to locate
- All Implemented Interfaces:
Function<ProfileRequestContext,T>
public class DefaultPrincipalDeterminationStrategy<T extends Principal> extends Object implements Function<ProfileRequestContext,T>
Function that returns the first customPrincipal
of a particular type found on theAuthenticationResult
returned byAuthenticationContext.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.
-
-
Field Summary
Fields Modifier and Type Field Description private Function<ProfileRequestContext,AuthenticationContext>
authnContextLookupStrategy
Authentication context lookup strategy.private T
defaultPrincipal
Default Principal to return.private Class<T>
principalType
Type of Principal to return.
-
Constructor Summary
Constructors Constructor Description DefaultPrincipalDeterminationStrategy(Class<T> type, T principal)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
apply(ProfileRequestContext input)
void
setAuthenticationContextLookupStrategy(Function<ProfileRequestContext,AuthenticationContext> strategy)
Set lookup strategy forAuthenticationContext
.
-
-
-
Field Detail
-
principalType
@Nonnull private final Class<T extends Principal> principalType
Type of Principal to return.
-
defaultPrincipal
@Nonnull private final T extends Principal defaultPrincipal
Default Principal to return.
-
authnContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,AuthenticationContext> authnContextLookupStrategy
Authentication context lookup strategy.
-
-
Constructor Detail
-
DefaultPrincipalDeterminationStrategy
public DefaultPrincipalDeterminationStrategy(@Nonnull @ParameterName(name="type") Class<T> type, @Nonnull @ParameterName(name="principal") T principal)
Constructor.- Parameters:
type
- class type for Principal typeprincipal
- default Principal to return
-
-
Method Detail
-
setAuthenticationContextLookupStrategy
public void setAuthenticationContextLookupStrategy(@Nonnull Function<ProfileRequestContext,AuthenticationContext> strategy)
Set lookup strategy forAuthenticationContext
.- Parameters:
strategy
- lookup strategy
-
apply
@Nullable public T apply(@Nullable ProfileRequestContext input)
- Specified by:
apply
in interfaceFunction<ProfileRequestContext,T extends Principal>
-
-