Class AuthenticationResult
- All Implemented Interfaces:
Predicate<ProfileRequestContext>,PrincipalSupportingComponent
Any authentication flow that succeeds must produce a single instance of this object. It may be composite, in the sense that it may represent a combination of separate exchanges that make up a single overall result, but the IdP always acts on a single result as the product of a given request for a login.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classInner class that delegates reuse condition evaluation to the underlyingAuthenticationFlowDescriptor.(package private) classInner class that delegates revocation condition evaluation to the underlyingAuthenticationFlowDescriptor.(package private) classInner class implementing a predicate that checks for containedProxyAuthenticationPrincipalobjects and enforces any restrictions on reuse based on the current request. -
Field Summary
FieldsModifier and TypeFieldDescriptionA map of additional data to associate with the result.private final StringThe identifier of the flow used to produce this result.private InstantThe time that the authentication completed.private InstantThe last time this result was used to bypass authentication.private booleanTracks whether a result was loaded from a previous session or created as part of the current request.private DurationOptional override of flow's lifetime policy for this result.private DurationOptional override of flow's inactivity timeout policy for this result.private Predicate<ProfileRequestContext>Whether this result can be reused.Whether this result should be considered revoked.private final SubjectThe Subject established by the authentication result. -
Constructor Summary
ConstructorsConstructorDescriptionAuthenticationResult(String flowId, Principal principal) Constructor.AuthenticationResult(String flowId, Subject newSubject) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets a mutable map of additional name/value string properties to associate with and store with the result.Get the flow used to authenticate the principal.Get the time that the authentication completed.Get the last time this result was used for authentication.Get the per-result lifetime policy if it exists.Get the effective lifetime policy for the result based on the provided flow descriptor.Get the per-result inactivity timeout policy if it exists.Get the effective timeout policy for the result based on the provided flow descriptor.Gets condition controlling whether this result should be reused for SSO.Gets the Subject identifying the authenticated entity.private StringGet a suitable principal name for logging/debugging use.getSupportedPrincipals(Class<T> c) Get an immutable set of supported custom principals that the component produces, supports, contains, etc.inthashCode()booleanGet whether this result was loaded from a session as the product of a previous request.voidsetAuthenticationInstant(Instant instant) Set the time that the authentication completed.voidsetLastActivityInstant(Instant instant) Set the last time result was used for authentication.voidSet the last activity instant for this result to the current time.voidsetPreviousResult(boolean flag) Set whether this result was loaded from a session as the product of a previous request.voidsetResultLifetime(Duration lifetime) Set the per-result lifetime policy.voidsetResultTimeout(Duration timeout) Set the per-result inactivity timeout policy.voidsetReuseCondition(Predicate<ProfileRequestContext> condition) Sets condition controlling whether this result should be reused for SSO.voidSets condition controlling whether this result has been revoked subsequent to creation.booleantest(ProfileRequestContext input) toString()
-
Field Details
-
subject
The Subject established by the authentication result. -
authenticationFlowId
The identifier of the flow used to produce this result. -
authenticationInstant
The time that the authentication completed. -
lastActivityInstant
The last time this result was used to bypass authentication. -
resultLifetime
Optional override of flow's lifetime policy for this result. -
resultTimeout
Optional override of flow's inactivity timeout policy for this result. -
previousResult
private boolean previousResultTracks whether a result was loaded from a previous session or created as part of the current request. -
additionalData
A map of additional data to associate with the result. -
reuseCondition
Whether this result can be reused. -
revocationCondition
Whether this result should be considered revoked.
-
-
Constructor Details
-
AuthenticationResult
Constructor.Sets the authentication instant to the current time.
- Parameters:
flowId- the workflow used to authenticate the subjectnewSubject- a Subject identifying the authenticated entity
-
AuthenticationResult
Constructor.Sets the authentication instant to the current time.
- Parameters:
flowId- the workflow used to authenticate the subjectprincipal- a Principal identifying the authenticated entity
-
-
Method Details
-
getReuseCondition
Gets condition controlling whether this result should be reused for SSO.- Returns:
- condition controlling whether result should be reused for SSO
- Since:
- 4.0.0
-
setReuseCondition
Sets condition controlling whether this result should be reused for SSO.- Parameters:
condition- condition to set- Since:
- 4.0.0
-
setRevocationCondition
public void setRevocationCondition(@Nullable BiPredicate<ProfileRequestContext, AuthenticationResult> condition) Sets condition controlling whether this result has been revoked subsequent to creation.- Parameters:
condition- condition to set- Since:
- 4.3.0
-
test
- Specified by:
testin interfacePredicate<ProfileRequestContext>
-
getSubject
Gets the Subject identifying the authenticated entity.- Returns:
- a Subject identifying the authenticated entity
-
getSupportedPrincipals
@Nonnull @Unmodifiable @NotLive public <T extends Principal> Set<T> getSupportedPrincipals(@Nonnull Class<T> c) Get an immutable set of supported custom principals that the component produces, supports, contains, etc.- Specified by:
getSupportedPrincipalsin interfacePrincipalSupportingComponent- Type Parameters:
T- type of Principal to inquire on- Parameters:
c- type of Principal to inquire on- Returns:
- a set of matching principals
-
getAuthenticationFlowId
Get the flow used to authenticate the principal.- Returns:
- flow used to authenticate the principal
-
getAuthenticationInstant
Get the time that the authentication completed.- Returns:
- time that the authentication completed
-
setAuthenticationInstant
Set the time that the authentication completed.- Parameters:
instant- time that the authentication completed, never non-positive
-
getLastActivityInstant
Get the last time this result was used for authentication.- Returns:
- last time this result was used for authentication
-
setLastActivityInstant
Set the last time result was used for authentication.- Parameters:
instant- last time result was used to bypass authentication
-
setLastActivityInstantToNow
public void setLastActivityInstantToNow()Set the last activity instant for this result to the current time. -
getResultLifetime
Get the effective lifetime policy for the result based on the provided flow descriptor.- Parameters:
flow- correspnding flow descriptor- Returns:
- effective lifetime policy combining result and flow
- Since:
- 5.2.0
-
getResultLifetime
Get the per-result lifetime policy if it exists.If set, this overrides the more typical flow-based lifetime setting for the result.
- Returns:
- per-result lifetime policy
- Since:
- 5.2.0
-
setResultLifetime
Set the per-result lifetime policy.If null, the underlying flow definition's lifetime applies.
- Parameters:
lifetime- lifetime to set- Since:
- 5.2.0
-
getResultTimeout
Get the effective timeout policy for the result based on the provided flow descriptor.- Parameters:
flow- correspnding flow descriptor- Returns:
- effective timeout policy combining result and flow
- Since:
- 5.2.0
-
getResultTimeout
Get the per-result inactivity timeout policy if it exists.If set, this overrides the more typical flow-based timeout setting for the result.
- Returns:
- per-result inactivity timeout policy
- Since:
- 5.2.0
-
setResultTimeout
Set the per-result inactivity timeout policy.If null, the underlying flow definition's inactivity timeout applies.
- Parameters:
timeout- timeout to set- Since:
- 5.2.0
-
isPreviousResult
public boolean isPreviousResult()Get whether this result was loaded from a session as the product of a previous request.- Returns:
- true iff this result was produced as part of an earlier request
- Since:
- 3.3.0
-
setPreviousResult
public void setPreviousResult(boolean flag) Set whether this result was loaded from a session as the product of a previous request.- Parameters:
flag- flag to set- Since:
- 3.3.0
-
getAdditionalData
Gets a mutable map of additional name/value string properties to associate with and store with the result.Note that the implementation may or may not explicitly break on null keys or values but using them is not intended to work and the behavior in such cases is unspecified.
- Returns:
- a mutable map
- Since:
- 4.0.0
-
hashCode
public int hashCode() -
equals
-
toString
-
getSubjectName
Get a suitable principal name for logging/debugging use.- Returns:
- a principal name for logging/debugging
-