Package net.shibboleth.idp.authn.context
Class RequestedPrincipalContext
java.lang.Object
org.opensaml.messaging.context.BaseContext
net.shibboleth.idp.authn.context.RequestedPrincipalContext
- All Implemented Interfaces:
Iterable<BaseContext>
A context that holds information about an authentication request's
requirement for a specific custom
Principal.
Authentication protocols with features for requesting specific forms of
authentication will populate this context type with an expression of those
requirements in the form of a protocol-specific operator string and an ordered
list of custom Principal objects.
During the authentication process, interactions with
PrincipalSupportingComponent-supporting objects
will depend on them satisfying context requirements, via the use of registered
PrincipalEvalPredicateFactory objects.
Upon successful authentication the most appropriate "matching" Principal will be
saved back to this context for use in generating a protocol response.
- Parent:
AuthenticationContext- Added:
- Before the authentication process begins
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensaml.messaging.context.BaseContext
BaseContext.ContextSetNoRemoveIteratorDecorator, BaseContext.DeprecatedContextClassNameLookAside -
Field Summary
FieldsModifier and TypeFieldDescriptionThe registry of predicate factories for custom principal evaluation.private booleanWhether the requirement was applied due to local policy?private PrincipalThe principal that satisfied the request, if any.private StringComparison operator specific to request protocol.The principals reflecting the request requirements. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the principal that matched the request's requirements, if any.Get the comparison operator for matching requested principals.getPredicate(Principal principal) Get a predicate to apply based on a principal type and the content of this context.Get the registry of predicate factories for custom principal evaluation.Get an immutable list of principals reflecting the request requirements.booleanisAcceptable(Collection<Principal> principals) Helper method that evaluatesPrincipalobjects against this context to determine if the input is compatible with it.booleanisAcceptable(PrincipalSupportingComponent component) Helper method that evaluates aPrincipalSupportingComponentagainst this context to determine if the input is compatible with it.<T extends Principal>
booleanisAcceptable(T principal) Helper method that evaluates aPrincipalobject against this context to determine if the input is compatible with it.booleanGet whether the context was populated in response to a requirement applied by IdP policy.setImposedLocally(boolean flag) Set whether the context was populated in response to a requirement applied by IdP policy.setMatchingPrincipal(Principal principal) Set the principal that matched the request's requirements, if any.setOperator(String operator) Set the comparison operator for matching requested principals.Set the registry of predicate factories for custom principal evaluation.setRequestedPrincipals(List<Principal> principals) Set list of principals reflecting the request requirements.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, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
evalRegistry
The registry of predicate factories for custom principal evaluation. -
operatorString
Comparison operator specific to request protocol. -
requestedPrincipals
The principals reflecting the request requirements. -
imposedLocally
private boolean imposedLocallyWhether the requirement was applied due to local policy? -
matchingPrincipal
The principal that satisfied the request, if any.
-
-
Constructor Details
-
RequestedPrincipalContext
public RequestedPrincipalContext()Constructor.
-
-
Method Details
-
getPrincipalEvalPredicateFactoryRegistry
Get the registry of predicate factories for custom principal evaluation.- Returns:
- predicate factory registry
- Since:
- 3.3.0
-
setPrincipalEvalPredicateFactoryRegistry
@Nonnull public RequestedPrincipalContext setPrincipalEvalPredicateFactoryRegistry(@Nonnull PrincipalEvalPredicateFactoryRegistry registry) Set the registry of predicate factories for custom principal evaluation.- Parameters:
registry- predicate factory registry- Returns:
- this context
- Since:
- 3.3.0
-
getOperator
Get the comparison operator for matching requested principals.- Returns:
- comparison operator
-
setOperator
Set the comparison operator for matching requested principals.- Parameters:
operator- comparison operator- Returns:
- this context
-
getRequestedPrincipals
Get an immutable list of principals reflecting the request requirements.- Returns:
- immutable list of principals
-
setRequestedPrincipals
@Nonnull public RequestedPrincipalContext setRequestedPrincipals(@Nonnull List<Principal> principals) Set list of principals reflecting the request requirements.- Parameters:
principals- list of principals- Returns:
- this context
-
isImposedLocally
public boolean isImposedLocally()Get whether the context was populated in response to a requirement applied by IdP policy.A false value implies that an RP/SP's requirement resulted in the creation of this context.
- Returns:
- true iff the context was populated due to local requirements applied by the IdP
- Since:
- 5.2.0
-
setImposedLocally
Set whether the context was populated in response to a requirement applied by IdP policy.- Parameters:
flag- flag to set- Returns:
- this context
- Since:
- 5.2.0
-
getMatchingPrincipal
Get the principal that matched the request's requirements, if any.- Returns:
- a matching principal, or null
-
setMatchingPrincipal
Set the principal that matched the request's requirements, if any.- Parameters:
principal- a matching principal, or null- Returns:
- this context
-
getPredicate
Get a predicate to apply based on a principal type and the content of this context.- Parameters:
principal- principal to obtain predicate for- Returns:
- predicate or null
-
isAcceptable
Helper method that evaluates aPrincipalSupportingComponentagainst this context to determine if the input is compatible with it.- Parameters:
component- component to evaluate- Returns:
- true iff the input is compatible with the requested authentication requirements
- Since:
- 3.3.0
-
isAcceptable
Helper method that evaluatesPrincipalobjects against this context to determine if the input is compatible with it.- Parameters:
principals- principal(s) to evaluate- Returns:
- true iff the input is compatible with the requested authentication requirements
- Since:
- 3.3.0
-
isAcceptable
Helper method that evaluates aPrincipalobject against this context to determine if the input is compatible with it.- Type Parameters:
T- type of principal- Parameters:
principal- principal to evaluate- Returns:
- true iff the input is compatible with the requested authentication requirements
-