Package net.shibboleth.idp.authn.context

# Class AuthenticationErrorContext

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

All Implemented Interfaces:
  `Iterable<BaseContext>`

public final class AuthenticationErrorContext extends BaseContext
A context that holds information about authentication failures.

The login process is particularly prone to requiring detailed error information to provide appropriate user feedback and auditing, and this context tracks errors that occur and preserves detailed information about the kind of errors encountered in multi-part authentication flows.

Parent:
  `AuthenticationContext`
Added:
  After authentication fails

## 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>`
`classifiedErrors`
Error conditions detected through classified error messages.
`private List<Exception>`
`exceptions`
Ordered list of exceptions encountered.

## Constructor Summary

Constructors
Constructor
Description
`AuthenticationErrorContext()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`AuthenticationErrorContext`
`addClassifiedError(String error)`
Adds a classified error to the context, ensuring that it will be returned from `getLastClassifiedError()` until another is added.
`Collection<String>`
`getClassifiedErrors()`
Get a mutable collection of error "tokens" associated with the context.
`List<Exception>`
`getExceptions()`
Get an immutable list of the exceptions encountered.
`String`
`getLastClassifiedError()`
Gets the last classified error added, or null if none.
`boolean`
`isClassifiedError(String error)`
Check for the presence of a particular error condition in the context.

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

### exceptions

@Nonnull private List<Exception> exceptions
Ordered list of exceptions encountered.

### classifiedErrors

@Nonnull private Collection<String> classifiedErrors
Error conditions detected through classified error messages.

## Constructor Details

### AuthenticationErrorContext

public AuthenticationErrorContext()
Constructor.

## Method Details

### getExceptions

@Nonnull @Live public List<Exception> getExceptions()
Get an immutable list of the exceptions encountered.

Returns:
  immutable list of exceptions

### getClassifiedErrors

@Nonnull @Live public Collection<String> getClassifiedErrors()
Get a mutable collection of error "tokens" associated with the context.

Returns:
  mutable collection of error strings

### isClassifiedError

public boolean isClassifiedError(@Nonnull @NotEmpty String error)
Check for the presence of a particular error condition in the context.

Parameters:
  `error` - the condition to check for
Returns:
  true iff the context contains the error condition specified

### addClassifiedError

@Nonnull public AuthenticationErrorContext addClassifiedError(@Nonnull @NotEmpty String error)
Adds a classified error to the context, ensuring that it will be returned from `getLastClassifiedError()` until another is added.

Parameters:
  `error` - error to add
Returns:
  this context
Since:
  5.0.0

### getLastClassifiedError

@Nullable public String getLastClassifiedError()
Gets the last classified error added, or null if none.

Returns:
  last error added or null
Since:
  5.0.0