Package net.shibboleth.idp.authn.context

# Class ExternalAuthenticationContext

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

All Implemented Interfaces:
  `Iterable<BaseContext>`

public final class ExternalAuthenticationContext extends BaseContext
A context representing the state of an externalized authentication attempt, a case where authentication happens outside of a web flow.

Parent:
  `AuthenticationContext`
Added:
  Before dispatching control to an external 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 Collection<String>`
`authenticatingAuthorities`
Proxied authenticating sources.
`private String`
`authnError`
Error message.
`private String`
`authnEvent`
Event.
`private Exception`
`authnException`
Exception.
`private Instant`
`authnInstant`
Time of authentication.
`private Duration`
`authnLifetime`
Override for result lifetime.
`private Duration`
`authnTimeout`
Override for result timeout.
`private boolean`
`doNotCache`
Flag preventing caching of result for SSO.
`private final ExternalAuthentication`
`externalAuthentication`
Implementation object.
`private String`
`flowExecutionUrl`
Value of flowExecutionUrl on branching from flow.
`private boolean`
`previousResult`
Flag indicating this "new" result is really "old".
`private Principal`
`principal`
A `Principal` that was authenticated.
`private String`
`principalName`
Name of a principal that was authenticated.
`private Subject`
`subject`
Name of a `Subject` that was authenticated.

## Constructor Summary

Constructors
Constructor
Description
`ExternalAuthenticationContext(ExternalAuthentication authentication)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`doNotCache()`
Get the "do not cache" flag.
`Collection<String>`
`getAuthenticatingAuthorities()`
Get a mutable, ordered list of proxied authentication sources.
`String`
`getAuthnError()`
Get an error message from the authentication process.
`String`
`getAuthnEvent()`
Get a Spring Web Flow event from the authentication process.
`Exception`
`getAuthnException()`
Get an exception from the authentication process.
`Instant`
`getAuthnInstant()`
Get the time of authentication.
`Duration`
`getAuthnLifetime()`
Get a custom lifetime to apply to the built `AuthenticationResult`.
`Duration`
`getAuthnTimeout()`
Get a custom timeout to apply to the built `AuthenticationResult`.
`ExternalAuthentication`
`getExternalAuthentication()`
Get the `ExternalAuthentication` object installed in the context.
`String`
`getFlowExecutionUrl()`
Get the flow execution URL to return control to.
`Principal`
`getPrincipal()`
Get a `Principal` that was authenticated.
`String`
`getPrincipalName()`
Get the name of a principal that was authenticated.
`Subject`
`getSubject()`
Get a `Subject` that was authenticated.
`boolean`
`isPreviousResult()`
Get whether this result is the product of an external SSO event and not a new act of authentication.
`ExternalAuthenticationContext`
`setAuthnError(String message)`
Set an error message from the authentication process.
`ExternalAuthenticationContext`
`setAuthnEvent(String event)`
Set a Spring Web Flow event from the authentication process.
`ExternalAuthenticationContext`
`setAuthnException(Exception exception)`
Set an exception from the authentication process.
`ExternalAuthenticationContext`
`setAuthnInstant(Instant instant)`
Set the time of authentication.
`ExternalAuthenticationContext`
`setAuthnLifetime(Duration lifetime)`
Set a custom lifetime to apply to the built `AuthenticationResult`.
`ExternalAuthenticationContext`
`setAuthnTimeout(Duration timeout)`
Set a custom timeout to apply to the built `AuthenticationResult`.
`ExternalAuthenticationContext`
`setDoNotCache(boolean flag)`
Set the "do not cache" flag.
`ExternalAuthenticationContext`
`setFlowExecutionUrl(String url)`
Set the flow execution URL to return control to.
`ExternalAuthenticationContext`
`setPreviousResult(boolean flag)`
Set whether this result is the product of an external SSO event and not a new act of authentication.
`ExternalAuthenticationContext`
`setPrincipal(Principal prin)`
Set a `Principal` that was authenticated.
`ExternalAuthenticationContext`
`setPrincipalName(String name)`
Set the name of a principal that was authenticated.
`ExternalAuthenticationContext`
`setSubject(Subject sub)`
Set a `Subject` that was authenticated.

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

### externalAuthentication

@Nonnull private final ExternalAuthentication externalAuthentication
Implementation object.

### flowExecutionUrl

@Nullable private String flowExecutionUrl
Value of flowExecutionUrl on branching from flow.

### principal

@Nullable private Principal principal
A `Principal` that was authenticated.

### principalName

@Nullable private String principalName
Name of a principal that was authenticated.

### subject

@Nullable private Subject subject
Name of a `Subject` that was authenticated.

### authnInstant

@Nullable private Instant authnInstant
Time of authentication.

### authnLifetime

@Nullable private Duration authnLifetime
Override for result lifetime.

### authnTimeout

@Nullable private Duration authnTimeout
Override for result timeout.

### authenticatingAuthorities

@Nonnull private Collection<String> authenticatingAuthorities
Proxied authenticating sources.

### authnError

@Nullable private String authnError
Error message.

### authnException

@Nullable private Exception authnException
Exception.

### authnEvent

@Nullable private String authnEvent
Event.

### doNotCache

private boolean doNotCache
Flag preventing caching of result for SSO.

### previousResult

private boolean previousResult
Flag indicating this "new" result is really "old".

## Constructor Details

### ExternalAuthenticationContext

public ExternalAuthenticationContext(@Nonnull ExternalAuthentication authentication)
Constructor.

Parameters:
  `authentication` - implementation object

## Method Details

### getExternalAuthentication

@Nonnull public ExternalAuthentication getExternalAuthentication()
Get the `ExternalAuthentication` object installed in the context.

Returns:
  the external authentication implementation
Since:
  4.0.0

### getFlowExecutionUrl

@Nullable public String getFlowExecutionUrl()
Get the flow execution URL to return control to.

Returns:
  return location

### setFlowExecutionUrl

@Nonnull public ExternalAuthenticationContext setFlowExecutionUrl(@Nullable String url)
Set the flow execution URL to return control to.

Parameters:
  `url` - return location
Returns:
  this context

### getPrincipal

@Nullable public Principal getPrincipal()
Get a `Principal` that was authenticated.

Returns:
  the principal

### setPrincipal

@Nonnull public ExternalAuthenticationContext setPrincipal(@Nullable Principal prin)
Set a `Principal` that was authenticated.

Parameters:
  `prin` - principal to set
Returns:
  this context

### getPrincipalName

@Nullable public String getPrincipalName()
Get the name of a principal that was authenticated.

Returns:
  name of a principal

### setPrincipalName

@Nonnull public ExternalAuthenticationContext setPrincipalName(@Nullable String name)
Set the name of a principal that was authenticated.

Parameters:
  `name` - name of principal to set
Returns:
  this context

### getSubject

@Nullable public Subject getSubject()
Get a `Subject` that was authenticated.

Returns:
  subject that was authenticated

### setSubject

@Nonnull public ExternalAuthenticationContext setSubject(@Nullable Subject sub)
Set a `Subject` that was authenticated.

Parameters:
  `sub` - The subject to set
Returns:
  this context

### getAuthnInstant

@Nullable public Instant getAuthnInstant()
Get the time of authentication.

Returns:
  time of authentication

### setAuthnInstant

@Nonnull public ExternalAuthenticationContext setAuthnInstant(@Nullable Instant instant)
Set the time of authentication.

Parameters:
  `instant` - time of authentication to set
Returns:
  this context

### getAuthnLifetime

@Nullable public Duration getAuthnLifetime()
Get a custom lifetime to apply to the built `AuthenticationResult`.

Returns:
  override of result lifetime
Since:
  5.2.0

### setAuthnLifetime

@Nonnull public ExternalAuthenticationContext setAuthnLifetime(@Nullable Duration lifetime)
Set a custom lifetime to apply to the built `AuthenticationResult`.

Parameters:
  `lifetime` - override of result lifetime
Returns:
  this context
Since:
  5.2.0

### getAuthnTimeout

@Nullable public Duration getAuthnTimeout()
Get a custom timeout to apply to the built `AuthenticationResult`.

Returns:
  override of result timeout
Since:
  5.2.0

### setAuthnTimeout

@Nonnull public ExternalAuthenticationContext setAuthnTimeout(@Nullable Duration timeout)
Set a custom timeout to apply to the built `AuthenticationResult`.

Parameters:
  `timeout` - override of result timeout
Returns:
  this context
Since:
  5.2.0

### getAuthenticatingAuthorities

@Nonnull @Live public Collection<String> getAuthenticatingAuthorities()
Get a mutable, ordered list of proxied authentication sources.

Returns:
  proxied authentication sources
Since:
  3.4.0

### getAuthnError

@Nullable public String getAuthnError()
Get an error message from the authentication process.

Returns:
  an error message

### setAuthnError

@Nonnull public ExternalAuthenticationContext setAuthnError(@Nullable String message)
Set an error message from the authentication process.

Parameters:
  `message` - message to set
Returns:
  this context

### getAuthnException

@Nullable public Exception getAuthnException()
Get an exception from the authentication process.

Returns:
  an exception

### setAuthnException

@Nonnull public ExternalAuthenticationContext setAuthnException(@Nullable Exception exception)
Set an exception from the authentication process.

Parameters:
  `exception` - exception to set
Returns:
  this context

### getAuthnEvent

@Nullable public String getAuthnEvent()
Get a Spring Web Flow event from the authentication process.

Returns:
  an event string
Since:
  5.2.0

### setAuthnEvent

@Nonnull public ExternalAuthenticationContext setAuthnEvent(@Nullable String event)
Set a Spring Web Flow event from the authentication process.

Parameters:
  `event` - event to set
Returns:
  this context
Since:
  5.2.0

### doNotCache

public boolean doNotCache()
Get the "do not cache" flag.

Returns:
  true iff the result of the authentication should not be cached

### setDoNotCache

@Nonnull public ExternalAuthenticationContext setDoNotCache(boolean flag)
Set the "do not cache" flag.

Parameters:
  `flag` - flag to set
Returns:
  this context

### isPreviousResult

public boolean isPreviousResult()
Get whether this result is the product of an external SSO event and not a new act of authentication.

Returns:
  true iff this result was produced as part of an earlier request
Since:
  3.3.0

### setPreviousResult

@Nonnull public ExternalAuthenticationContext setPreviousResult(boolean flag)
Set whether this result is the product of an external SSO event and not a new act of authentication.

Parameters:
  `flag` - flag to set
Returns:
  this context
Since:
  3.3.0