public class PredicateRoleDescriptorResolver extends AbstractIdentifiedInitializableComponent implements RoleDescriptorResolver
RoleDescriptorResolver which wraps an instance of MetadataResolver to
support basic EntityDescriptor resolution, and then performs further role-related filtering over the
returned EntityDescriptor.
This implementation passes the input CriteriaSet through to the wrapped metadata resolver as-is.
This implementation also supports applying arbitrary predicates to the returned role descriptors, either passed
directly as instances of EvaluableRoleDescriptorCriterion in the criteria, or resolved dynamically
from other criteria via an instance of CriterionPredicateRegistry.
| Modifier and Type | Field and Description |
|---|---|
private CriterionPredicateRegistry<RoleDescriptor> |
criterionPredicateRegistry
Registry used in resolving predicates from criteria.
|
private MetadataResolver |
entityDescriptorResolver
Resolver of EntityDescriptors.
|
private static com.google.common.base.Predicate<org.opensaml.core.xml.XMLObject> |
IS_VALID_PREDICATE
Predicate for evaluating whether a TimeboundSAMLObject is valid.
|
private org.slf4j.Logger |
log
Logger.
|
private boolean |
requireValidMetadata
Whether metadata is required to be valid.
|
private boolean |
resolveViaPredicatesOnly
Flag indicating whether resolution may be performed solely by applying predicates to the
entire metadata collection.
|
private boolean |
satisfyAnyPredicates
Flag which determines whether predicates used in filtering are connected by
a logical 'OR' (true) or by logical 'AND' (false).
|
private boolean |
useDefaultPredicateRegistry
Flag which determines whether the default predicate registry will be used if no one is supplied explicitly.
|
| Constructor and Description |
|---|
PredicateRoleDescriptorResolver(MetadataResolver mdResolver)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doInitialize()
Subclasses should override this method to perform any initialization logic necessary.
|
protected Iterable<RoleDescriptor> |
getAllCandidates(Iterable<EntityDescriptor> entityDescriptors)
Obtain all role descriptors contained by the input entity descriptors.
|
protected Iterable<RoleDescriptor> |
getCandidatesByRoleAndProtocol(Iterable<EntityDescriptor> entityDescriptors,
CriteriaSet criteria)
Obtain the role descriptors contained by the input entity descriptors which match
the specified role and protocol criteria.
|
CriterionPredicateRegistry<RoleDescriptor> |
getCriterionPredicateRegistry()
Get the registry used in resolving predicates from criteria.
|
protected boolean |
haveRoleCriteria(CriteriaSet criteria)
Determine if have entity role criteria.
|
boolean |
isRequireValidMetadata() |
boolean |
isResolveViaPredicatesOnly()
Get the flag indicating whether resolution may be performed solely
by applying predicates to the entire metadata collection.
|
boolean |
isSatisfyAnyPredicates()
Get the flag indicating whether resolved credentials may satisfy any predicates
(i.e.
|
boolean |
isUseDefaultPredicateRegistry()
Get the flag which determines whether the default predicate registry will be used
if one is not supplied explicitly.
|
protected Iterable<RoleDescriptor> |
predicateFilterCandidates(Iterable<RoleDescriptor> candidates,
CriteriaSet criteria,
boolean onEmptyPredicatesReturnEmpty)
Filter the supplied candidates by resolving predicates from the supplied criteria and applying
the predicates to return a filtered
Iterable. |
Iterable<RoleDescriptor> |
resolve(CriteriaSet criteria) |
RoleDescriptor |
resolveSingle(CriteriaSet criteria) |
void |
setCriterionPredicateRegistry(CriterionPredicateRegistry<RoleDescriptor> registry)
Set the registry used in resolving predicates from criteria.
|
void |
setRequireValidMetadata(boolean require) |
void |
setResolveViaPredicatesOnly(boolean flag)
Set the flag indicating whether resolution may be performed solely
by applying predicates to the entire metadata collection.
|
void |
setSatisfyAnyPredicates(boolean flag)
Set the flag indicating whether resolved credentials may satisfy any predicates
(i.e.
|
void |
setUseDefaultPredicateRegistry(boolean flag)
Set the flag which determines whether the default predicate registry will be used
if one is not supplied explicitly.
|
getId, setIddestroy, doDestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetIdprivate static final com.google.common.base.Predicate<org.opensaml.core.xml.XMLObject> IS_VALID_PREDICATE
private org.slf4j.Logger log
private boolean requireValidMetadata
private MetadataResolver entityDescriptorResolver
private boolean satisfyAnyPredicates
private CriterionPredicateRegistry<RoleDescriptor> criterionPredicateRegistry
private boolean useDefaultPredicateRegistry
private boolean resolveViaPredicatesOnly
public PredicateRoleDescriptorResolver(@Nonnull @ParameterName(name="mdResolver") MetadataResolver mdResolver)
mdResolver - the resolver of EntityDescriptorspublic boolean isRequireValidMetadata()
isRequireValidMetadata in interface RoleDescriptorResolverpublic void setRequireValidMetadata(boolean require)
setRequireValidMetadata in interface RoleDescriptorResolverpublic boolean isSatisfyAnyPredicates()
Defaults to false.
public void setSatisfyAnyPredicates(boolean flag)
Defaults to false.
flag - true if must satisfy all, false otherwise@NonnullAfterInit public CriterionPredicateRegistry<RoleDescriptor> getCriterionPredicateRegistry()
public void setCriterionPredicateRegistry(@Nullable CriterionPredicateRegistry<RoleDescriptor> registry)
registry - the registry instance to usepublic boolean isUseDefaultPredicateRegistry()
Defaults to true.
public void setUseDefaultPredicateRegistry(boolean flag)
Defaults to true.
flag - true if should use default registry, false otherwisepublic boolean isResolveViaPredicatesOnly()
public void setResolveViaPredicatesOnly(boolean flag)
flag - true if resolution may be attempted solely via predicates, false if notprotected void doInitialize()
throws ComponentInitializationException
doInitialize in class AbstractIdentifiedInitializableComponentComponentInitializationException - thrown if there is a problem initializing the provider@Nullable public RoleDescriptor resolveSingle(CriteriaSet criteria) throws ResolverException
resolveSingle in interface Resolver<RoleDescriptor,CriteriaSet>ResolverException@Nonnull public Iterable<RoleDescriptor> resolve(CriteriaSet criteria) throws ResolverException
resolve in interface Resolver<RoleDescriptor,CriteriaSet>ResolverExceptionprotected boolean haveRoleCriteria(@Nonnull CriteriaSet criteria)
criteria - the current criteria setprotected Iterable<RoleDescriptor> getCandidatesByRoleAndProtocol(@Nonnull Iterable<EntityDescriptor> entityDescriptors, @Nonnull CriteriaSet criteria)
This method should only be called if haveRoleCriteria(CriteriaSet) evaluates to true.
entityDescriptors - the entity descriptors on which to operatecriteria - the current criteria setprotected Iterable<RoleDescriptor> getAllCandidates(@Nonnull Iterable<EntityDescriptor> entityDescriptors)
entityDescriptors - the entity descriptors on which to operateprotected Iterable<RoleDescriptor> predicateFilterCandidates(@Nonnull Iterable<RoleDescriptor> candidates, @Nonnull CriteriaSet criteria, boolean onEmptyPredicatesReturnEmpty) throws ResolverException
Iterable.candidates - the candidates to evaluatecriteria - the criteria set to evaluateonEmptyPredicatesReturnEmpty - if true and no predicates are supplied, then return an empty iterable;
otherwise return the original input candidatesResolverException - if there is a fatal error during resolutionCopyright © 1999–2019 Shibboleth Consortium. All rights reserved.