Package net.shibboleth.idp.authn.context

# Class MultiFactorAuthenticationContext

java.lang.Object
org.opensaml.messaging.context.BaseContext
net.shibboleth.idp.authn.context.MultiFactorAuthenticationContext

All Implemented Interfaces:
  `Iterable<BaseContext>`

public final class MultiFactorAuthenticationContext extends BaseContext
A context that holds information about the intermediate state of the multi-factor login flow.

Since:
  3.3.0
Parent:
  `AuthenticationContext`
Added:
  At the beginning of the multi-factor login flow
Removed:
  At the end of the multi-factor login flow

## Nested Class Summary

## Nested classes/interfaces inherited from class org.opensaml.messaging.context.BaseContext

`BaseContext.ContextSetNoRemoveIteratorDecorator, BaseContext.DeprecatedContextClassNameLookAside`

## Field Summary

Fields
Modifier and Type
Field
Description
`private final Map<String,AuthenticationResult>`
`activeResults`
Authentication results that are active (may be generated earlier or during current request).
`private String`
`event`
A SWF event to signal as the completion of the MFA flow.
`private AuthenticationFlowDescriptor`
`mfaFlowDescriptor`
Login flow descriptor for the MFA flow.
`private String`
`nextFlowId`
The next logical flow due to execute (or the currently executing flow during subflow execution).
`private String`
`nextWebFlowId`
The next webflow due to execute (or the currently executing web flow during subflow execution).
`private Map<String,MultiFactorAuthenticationTransition>`
`transitionMap`
Map of login "factors" (flows) and the transition rules to run after them.

## Constructor Summary

Constructors
Constructor
Description
`MultiFactorAuthenticationContext()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Map<String,AuthenticationResult>`
`getActiveResults()`
Get a live list of the `AuthenticationResult` objects produced during the flow.
`AuthenticationFlowDescriptor`
`getAuthenticationFlowDescriptor()`
Get the `AuthenticationFlowDescriptor` representing the MFA flow.
`String`
`getEvent()`
Get an event that should be signaled as the result of the MFA flow.
`String`
`getNextFlowId()`
Get the next flow due to execute (or that is currently executing).
`String`
`getNextWebFlowId()`
Get the next webflow due to execute (or that is currently executing).
`Map<String,MultiFactorAuthenticationTransition>`
`getTransitionMap()`
Get a live map of the transitions to apply.
`boolean`
`isAcceptable()`
Get whether one or more of the active results in this context satisfies the request.
`boolean`
`isActive(Principal principal)`
Get whether any active result in this context contains the input `Principal`.
`MultiFactorAuthenticationContext`
`setAuthenticationFlowDescriptor(AuthenticationFlowDescriptor descriptor)`
Set the `AuthenticationFlowDescriptor` representing the MFA flow.
`MultiFactorAuthenticationContext`
`setEvent(String e)`
Set an event that should be signaled as the result of the MFA flow.
`MultiFactorAuthenticationContext`
`setNextFlowId(String id)`
Set the next flow due to execute.
`MultiFactorAuthenticationContext`
`setNextWebFlowId(String id)`
Set the next webflow due to execute.
`MultiFactorAuthenticationContext`
`setTransitionMap(Map<String,MultiFactorAuthenticationTransition> map)`
Set the map of transitions to apply, replacing any existing entries.

### Methods inherited from class org.opensaml.messaging.context.BaseContext

`addSubcontext, addSubcontext, clearSubcontexts, containsSubcontext, createSubcontext, ensureSubcontext, ensureSubcontext, getParent, getSubcontext, getSubcontext, getSubcontext, getSubcontext, iterator, removeFromParent, removeSubcontext, removeSubcontext, setParent`

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

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

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Field Details

### transitionMap

@Nonnull private Map<String,MultiFactorAuthenticationTransition> transitionMap
Map of login "factors" (flows) and the transition rules to run after them.

### activeResults

@Nonnull private final Map<String,AuthenticationResult> activeResults
Authentication results that are active (may be generated earlier or during current request).

### mfaFlowDescriptor

@Nullable private AuthenticationFlowDescriptor mfaFlowDescriptor
Login flow descriptor for the MFA flow.

### nextFlowId

@Nullable @NotEmpty private String nextFlowId
The next logical flow due to execute (or the currently executing flow during subflow execution).

### nextWebFlowId

@Nullable @NotEmpty private String nextWebFlowId
The next webflow due to execute (or the currently executing web flow during subflow execution).

### event

@Nullable @NotEmpty private String event
A SWF event to signal as the completion of the MFA flow.

## Constructor Details

### MultiFactorAuthenticationContext

public MultiFactorAuthenticationContext()
Constructor.

## Method Details

### getTransitionMap

@Nonnull @Live public Map<String,MultiFactorAuthenticationTransition> getTransitionMap()
Get a live map of the transitions to apply.

Returns:
  map of transition logic

### setTransitionMap

@Nonnull public MultiFactorAuthenticationContext setTransitionMap(@Nonnull Map<String,MultiFactorAuthenticationTransition> map)
Set the map of transitions to apply, replacing any existing entries.

Parameters:
  `map` - map of transition logic
Returns:
  this context

### getActiveResults

@Nonnull @Live public Map<String,AuthenticationResult> getActiveResults()
Get a live list of the `AuthenticationResult` objects produced during the flow.

Returns:
  list of results

### getAuthenticationFlowDescriptor

@Nullable public AuthenticationFlowDescriptor getAuthenticationFlowDescriptor()
Get the `AuthenticationFlowDescriptor` representing the MFA flow.

Returns:
  descriptor

### setAuthenticationFlowDescriptor

@Nonnull public MultiFactorAuthenticationContext setAuthenticationFlowDescriptor(@Nullable AuthenticationFlowDescriptor descriptor)
Set the `AuthenticationFlowDescriptor` representing the MFA flow.

Parameters:
  `descriptor` - login flow descriptor
Returns:
  this context

### getNextFlowId

@Nullable @NotEmpty public String getNextFlowId()
Get the next flow due to execute (or that is currently executing).

Returns:
  the ID of the next flow to execute

### setNextFlowId

@Nonnull public MultiFactorAuthenticationContext setNextFlowId(@Nullable @NotEmpty String id)
Set the next flow due to execute.

This also calls `setNextWebFlowId(String)` automatically.

Parameters:
  `id` - flow ID
Returns:
  this context

### getNextWebFlowId

@Nullable @NotEmpty public String getNextWebFlowId()
Get the next webflow due to execute (or that is currently executing).

This is distinct from the next "flow" in the case of login flows, to allow for the indirection between logical flow as a component designation and physical webflow implementation.

Returns:
  the ID of the next webflow to execute
Since:
  5.2.0

### setNextWebFlowId

@Nonnull public MultiFactorAuthenticationContext setNextWebFlowId(@Nullable @NotEmpty String id)
Set the next webflow due to execute.

Parameters:
  `id` - webflow ID
Returns:
  this context
Since:
  5.2.0

### getEvent

@Nullable @NotEmpty public String getEvent()
Get an event that should be signaled as the result of the MFA flow.

If set, the MFA flow will eventually terminate with this event once all transitions have completed.

Returns:
  event to signal

### setEvent

@Nonnull public MultiFactorAuthenticationContext setEvent(@Nullable @NotEmpty String e)
Set an event that should be signaled as the result of the MFA flow.

Parameters:
  `e` - event to signal
Returns:
  this context

### isAcceptable

public boolean isAcceptable()
Get whether one or more of the active results in this context satisfies the request.

Returns:
  true iff at least one of the active results satisfies the request

### isActive

public boolean isActive(@Nonnull Principal principal)
Get whether any active result in this context contains the input `Principal`.

This is a "crude" means of testing for the existence of a particular `Principal` inside an active result. Usually this is used to test for the existence of a particular custom value used to represent a particular login quality or type.

Parameters:
  `principal` - input to check for
Returns:
  true iff an active and presumably usable result contains the input
Since:
  5.0.0