Class AuthenticationFlowDescriptor
- All Implemented Interfaces:
Predicate<ProfileRequestContext>
,PrincipalSupportingComponent
,FlowDescriptor
,Component
,DestructableComponent
,IdentifiableComponent
,IdentifiedComponent
,InitializableComponent
,StorageSerializer<AuthenticationResult>
,Ordered
A flow models a sequence of profile actions that performs authentication in a particular way and satisfies various
constraints that may apply to an authentication request. Some of these constraints are directly exposed as properties
of the flow, and others can be found by examining the list of extended Principal
s that the flow exposes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
APredicate
that implements a cross-check between an effective proxy count of zero and whether a descriptor is honoring the limit.private class
AComparator
that compares the mapped weights of the two operands, using a weight of zero for any unmapped values. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Predicate<ProfileRequestContext>
Predicate that must be true for this flow to be usable for a given request.private boolean
Whether this flow should invoke discovery if no authenticating authority populated.static final String
Prefix convention for flow IDs.private Duration
Maximum amount of time since last usage that a flow should be considered active.private Duration
Maximum amount of time since first usage that a flow should be considered active.private int
Spring auto-wiring order.private PrincipalServiceManager
Access to principal services.Weighted sort oredering of custom Principals produced by flow(s).private boolean
Whether this flow should honor proxy restrictions toward RPs.private boolean
Whether this flow should honor proxy scoping restrictions toward IdPs.private StorageSerializer<AuthenticationResult>
Custom serializer for the results generated by this flow.private Predicate<ProfileRequestContext>
Whether this flow allows reuse of its results.Whether a result from this flow should be considered revoked.static final Duration
Additional allowance for storage of result records to avoid race conditions during use.Supported principals provided by delimited strings, for post-initialization override viaPrincipalServiceManager
.private BiConsumer<ProfileRequestContext,
Subject> Customizes subject prior to triggering subject canonicalization.private Subject
Supported principals, indexed by type, that the flow can produce.private boolean
Whether this flow supports forced authentication.private boolean
Whether this flow supports non-browser clients.private boolean
Whether this flow supports passive authentication.Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(long version, String context, String key, String value, Long expiration) protected void
boolean
<T extends Principal>
TgetHighestWeighted
(Collection<T> principals) Apply the current weighted map to find the highest-weighted object amongst the inputs.Get the maximum amount of time, since the last usage, a flow should be considered active.Get the maximum amount of time, since first usage, a flow should be considered active.int
getOrder()
Get condition controlling whether results from this flow should be reused for SSO.Get condition controlling whether a result from this flow should be considered revoked.Gets a subject decorating component called prior to completing authentication and passing control to subject canonicalization.Get a collection of supported non-user-specific principals that the flow may produce when it operates.getSupportedPrincipals
(Class<T> c) Get an immutable set of supported custom principals that the component produces, supports, contains, etc.int
hashCode()
boolean
Gets whether to invoke discovery subflow ifAuthenticationContext.getAuthenticatingAuthority()
is null.boolean
Get whether this flow supports forced authentication.boolean
Get whether this flow supports non-browser clients.boolean
Get whether this flow supports passive authentication.boolean
Gets whether this flow's results should honor restrictions on proxying toward RPs.boolean
Gets whether this flow's results should honor restrictions on proxying toward IdPs.boolean
isResultActive
(AuthenticationResult result) Check if a result generated by this flow is still active.newAuthenticationResult
(Subject subject) Creates a new instance of a compatibleAuthenticationResult
for use with the corresponding flow.serialize
(AuthenticationResult instance) void
setActivationCondition
(Predicate<ProfileRequestContext> condition) Set the activation condition in the form of aPredicate
such that iff the condition evaluates to true should the corresponding flow be allowed/possible.void
setDiscoveryRequired
(boolean flag) Sets whether to invoke discovery subflow ifAuthenticationContext.getAuthenticatingAuthority()
is null.void
setForcedAuthenticationSupported
(boolean isSupported) Set whether this flow supports forced authentication.void
setInactivityTimeout
(Duration timeout) Set the maximum amount of time, since the last usage, a flow should be considered active.void
setLifetime
(Duration flowLifetime) Set the maximum amount of time, since first usage, a flow should be considered active.void
setNonBrowserSupported
(boolean isSupported) Set whether this flow supports non-browser clients.void
setOrder
(int priority) Set the order/priority value for the bean.void
setPassiveAuthenticationSupported
(boolean isSupported) Set whether this flow supports passive authentication.void
Sets aPrincipalServiceManager
to use for string-based principal processing.void
Set the map of Principals to weight values to impose a sort order on any matching Principals found in the authentication result.void
setProxyRestrictionsEnforced
(boolean flag) Sets whether this flow's results should honor restrictions on proxying toward RPsvoid
setProxyScopingEnforced
(boolean flag) Sets whether this flow's results should honor restrictions on proxying toward IdPs.void
setResultSerializer
(StorageSerializer<AuthenticationResult> serializer) Set a custom serializer for results produced by this flow.void
setReuseCondition
(Predicate<ProfileRequestContext> condition) Set condition controlling whether results from this flow should be reused for SSO.void
Set condition controlling whether a result from this flow should be considered revoked.void
setSubjectDecorator
(BiConsumer<ProfileRequestContext, Subject> decorator) Sets a subject decorating component called prior to completing authentication and passing control to subject canonicalization.void
setSupportedPrincipals
(Collection<Principal> principals) Set supported non-user-specific principals that the flow may produce when it operates.void
setSupportedPrincipalsByString
(Collection<String> principals) Set supported non-user-specific principals that the flow may produce when it operates.boolean
test
(ProfileRequestContext input) toString()
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiableComponent
setId
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
FLOW_ID_PREFIX
Prefix convention for flow IDs.- See Also:
-
STORAGE_EXPIRATION_OFFSET
Additional allowance for storage of result records to avoid race conditions during use. -
order
private int orderSpring auto-wiring order. -
supportsNonBrowser
private boolean supportsNonBrowserWhether this flow supports non-browser clients. -
supportsPassive
private boolean supportsPassiveWhether this flow supports passive authentication. -
supportsForced
private boolean supportsForcedWhether this flow supports forced authentication. -
proxyRestrictionsEnforced
private boolean proxyRestrictionsEnforcedWhether this flow should honor proxy restrictions toward RPs. -
proxyScopingEnforced
private boolean proxyScopingEnforcedWhether this flow should honor proxy scoping restrictions toward IdPs. -
discoveryRequired
private boolean discoveryRequiredWhether this flow should invoke discovery if no authenticating authority populated. -
reuseCondition
Whether this flow allows reuse of its results. -
revocationCondition
Whether a result from this flow should be considered revoked. -
lifetime
Maximum amount of time since first usage that a flow should be considered active. -
inactivityTimeout
Maximum amount of time since last usage that a flow should be considered active. -
stringBasedPrincipals
Supported principals provided by delimited strings, for post-initialization override viaPrincipalServiceManager
. -
supportedPrincipals
Supported principals, indexed by type, that the flow can produce. Implemented for the moment using the Subject class for convenience to allow for class-based lookup in thegetSupportedPrincipals(java.lang.Class<T>)
method. -
activationCondition
Predicate that must be true for this flow to be usable for a given request. -
resultSerializer
Custom serializer for the results generated by this flow. -
principalWeightMap
Weighted sort oredering of custom Principals produced by flow(s). -
principalServiceManager
Access to principal services. -
subjectDecorator
Customizes subject prior to triggering subject canonicalization.
-
-
Constructor Details
-
AuthenticationFlowDescriptor
public AuthenticationFlowDescriptor()Constructor.
-
-
Method Details
-
getOrder
public int getOrder() -
setOrder
public void setOrder(int priority) Set the order/priority value for the bean.- Parameters:
priority
- priority value
-
isNonBrowserSupported
public boolean isNonBrowserSupported()Get whether this flow supports non-browser clients.- Returns:
- whether this flow supports non-browser clients
-
setNonBrowserSupported
public void setNonBrowserSupported(boolean isSupported) Set whether this flow supports non-browser clients.- Parameters:
isSupported
- whether this flow supports non-browser clients
-
isPassiveAuthenticationSupported
public boolean isPassiveAuthenticationSupported()Get whether this flow supports passive authentication.- Returns:
- whether this flow supports passive authentication
-
setPassiveAuthenticationSupported
public void setPassiveAuthenticationSupported(boolean isSupported) Set whether this flow supports passive authentication.- Parameters:
isSupported
- whether this flow supports passive authentication
-
isForcedAuthenticationSupported
public boolean isForcedAuthenticationSupported()Get whether this flow supports forced authentication.- Returns:
- whether this flow supports forced authentication
-
setForcedAuthenticationSupported
public void setForcedAuthenticationSupported(boolean isSupported) Set whether this flow supports forced authentication.- Parameters:
isSupported
- whether this flow supports forced authentication.
-
isProxyRestrictionsEnforced
public boolean isProxyRestrictionsEnforced()Gets whether this flow's results should honor restrictions on proxying toward RPs.- Returns:
- true iff proxying restrictions issued by IdPs should be honored
- Since:
- 4.0.0
-
setProxyRestrictionsEnforced
public void setProxyRestrictionsEnforced(boolean flag) Sets whether this flow's results should honor restrictions on proxying toward RPsDefaults to true.
- Parameters:
flag
- flag to set- Since:
- 4.0.0
-
isProxyScopingEnforced
public boolean isProxyScopingEnforced()Gets whether this flow's results should honor restrictions on proxying toward IdPs.- Returns:
- true iff proxying restrictions issued by RPs should be honored
- Since:
- 4.0.0
-
setProxyScopingEnforced
public void setProxyScopingEnforced(boolean flag) Sets whether this flow's results should honor restrictions on proxying toward IdPs.Defaults to false. Should be enabled for flows that represent proxied authentication.
- Parameters:
flag
- flag to set- Since:
- 4.0.0
-
isDiscoveryRequired
public boolean isDiscoveryRequired()Gets whether to invoke discovery subflow ifAuthenticationContext.getAuthenticatingAuthority()
is null.- Returns:
- whether to invoke discovery
- Since:
- 4.0.0
-
setDiscoveryRequired
public void setDiscoveryRequired(boolean flag) Sets whether to invoke discovery subflow ifAuthenticationContext.getAuthenticatingAuthority()
is null.Defaults to false.
- Parameters:
flag
- flag to set- Since:
- 4.0.0
-
getReuseCondition
Get condition controlling whether results from this flow should be reused for SSO.- Returns:
- condition
- Since:
- 4.0.1
-
setReuseCondition
Set condition controlling whether results from this flow should be reused for SSO.Defaults to a built-in condition that applies SP-imposed proxying rules on hop count when the flow is configured to enforce this.
- Parameters:
condition
- condition to set- Since:
- 3.4.0
-
getRevocationCondition
Get condition controlling whether a result from this flow should be considered revoked.- Returns:
- condition
- Since:
- 4.3.0
-
setRevocationCondition
public void setRevocationCondition(@Nullable BiPredicate<ProfileRequestContext, AuthenticationResult> condition) Set condition controlling whether a result from this flow should be considered revoked.- Parameters:
condition
- condition to set- Since:
- 4.3.0
-
getSubjectDecorator
Gets a subject decorating component called prior to completing authentication and passing control to subject canonicalization.- Returns:
- subject decorator
- Since:
- 4.1.0
-
setSubjectDecorator
Sets a subject decorating component called prior to completing authentication and passing control to subject canonicalization.- Parameters:
decorator
- the decorator to set- Since:
- 4.1.0
-
getLifetime
Get the maximum amount of time, since first usage, a flow should be considered active. A null indicates that there is no upper limit on the lifetime on an active flow.- Returns:
- maximum amount of time a flow should be considered active
-
setLifetime
Set the maximum amount of time, since first usage, a flow should be considered active. A null value indicates that there is no upper limit on the lifetime on an active flow.- Parameters:
flowLifetime
- the lifetime for the flow
-
getInactivityTimeout
Get the maximum amount of time, since the last usage, a flow should be considered active.Defaults to 30 minutes.
- Returns:
- the duration
-
setInactivityTimeout
Set the maximum amount of time, since the last usage, a flow should be considered active.- Parameters:
timeout
- the flow inactivity timeout, must be greater than zero
-
isResultActive
Check if a result generated by this flow is still active.- Parameters:
result
-AuthenticationResult
to check- Returns:
- true iff the result remains valid
-
getSupportedPrincipals
@Nonnull @NonnullElements @Unmodifiable 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:
getSupportedPrincipals
in interfacePrincipalSupportingComponent
- Type Parameters:
T
- type of Principal to inquire on- Parameters:
c
- type of Principal to inquire on- Returns:
- a set of matching principals
-
getSupportedPrincipals
Get a collection of supported non-user-specific principals that the flow may produce when it operates.The
Collection.remove(java.lang.Object)
method is not supported.- Returns:
- a live collection of supported principals
-
setSupportedPrincipals
Set supported non-user-specific principals that the flow may produce when it operates.- Parameters:
principals
- supported principals to add
-
setSupportedPrincipalsByString
Set supported non-user-specific principals that the flow may produce when it operates.The principals must be prefixed by the ID of the relevant
PrincipalService
followed by a '/'.Setting an empty list will leave any existing set unchanged. This is primarily provided to allow property-based override of an XML-based collection established with the previous method.
- Parameters:
principals
- supported principals to add- Since:
- 4.1.0
-
setActivationCondition
Set the activation condition in the form of aPredicate
such that iff the condition evaluates to true should the corresponding flow be allowed/possible.- Parameters:
condition
- predicate that controls activation of the flow
-
test
- Specified by:
test
in interfacePredicate<ProfileRequestContext>
-
setResultSerializer
Set a custom serializer for results produced by this flow.- Parameters:
serializer
- the custom serializer
-
setPrincipalWeightMap
Set the map of Principals to weight values to impose a sort order on any matching Principals found in the authentication result.This was moved from a stand-alone bean into the descriptor beans in order to eliminate stand-alone beans from the flow descriptor configuration files(s).
- Parameters:
map
- map to set- Since:
- 4.0.0
-
setPrincipalServiceManager
Sets aPrincipalServiceManager
to use for string-based principal processing.- Parameters:
manager
- manager to set- Since:
- 4.0.1
-
doInitialize
- Overrides:
doInitialize
in classAbstractIdentifiedInitializableComponent
- Throws:
ComponentInitializationException
-
newAuthenticationResult
Creates a new instance of a compatibleAuthenticationResult
for use with the corresponding flow.- Parameters:
subject
- the subject for the result- Returns:
- the new result
-
serialize
@Nonnull @NotEmpty public String serialize(@Nonnull AuthenticationResult instance) throws IOException - Specified by:
serialize
in interfaceStorageSerializer<AuthenticationResult>
- Throws:
IOException
-
deserialize
@Nonnull public AuthenticationResult deserialize(long version, @Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key, @Nonnull @NotEmpty String value, @Nonnull Long expiration) throws IOException - Specified by:
deserialize
in interfaceStorageSerializer<AuthenticationResult>
- Throws:
IOException
-
getHighestWeighted
@Nullable public <T extends Principal> T getHighestWeighted(@Nonnull @NonnullElements Collection<T> principals) Apply the current weighted map to find the highest-weighted object amongst the inputs.- Type Parameters:
T
- principal type- Parameters:
principals
- input collection- Returns:
- the highest weighted as governed by the map set via
setPrincipalWeightMap(Map)
- Since:
- 4.0.0
-
hashCode
public int hashCode() -
equals
-
toString
-