Package net.shibboleth.idp.authn.impl

# Class DefaultPrincipalDeterminationStrategy<T extends Principal>

java.lang.Object
net.shibboleth.idp.authn.impl.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 custom `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.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<ProfileRequestContext,AuthenticationContext>`
`authnContextLookupStrategy`
Authentication context lookup strategy.
`private final T`
`defaultPrincipal`
Default Principal to return.
`private final Class<T>`
`principalType`
Type of Principal to return.

## Constructor Summary

Constructors
Constructor
Description
`DefaultPrincipalDeterminationStrategy(Class<T> type, T principal)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`T`
`apply(ProfileRequestContext input)`
`void`
`setAuthenticationContextLookupStrategy(Function<ProfileRequestContext,AuthenticationContext> strategy)`
Set lookup strategy for `AuthenticationContext`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.function.Function

`andThen, compose`

## Field Details

### 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 Details

### DefaultPrincipalDeterminationStrategy

public DefaultPrincipalDeterminationStrategy(@Nonnull @ParameterName(name="type") Class<T> type, @Nonnull @ParameterName(name="principal") T principal)
Constructor.

Parameters:
  `type` - class type for Principal type
  `principal` - default Principal to return

## Method Details

### setAuthenticationContextLookupStrategy

public void setAuthenticationContextLookupStrategy(@Nonnull Function<ProfileRequestContext,AuthenticationContext> strategy)
Set lookup strategy for `AuthenticationContext`.

Parameters:
  `strategy` - lookup strategy

### apply

@Nullable public T apply(@Nullable ProfileRequestContext input)

Specified by:
  `apply` in interface `Function<ProfileRequestContext,T extends Principal>`