Class PredicateRoleDescriptorResolver
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
org.opensaml.saml.metadata.resolver.impl.PredicateRoleDescriptorResolver
- All Implemented Interfaces:
Component,DestructableComponent,IdentifiedComponent,InitializableComponent,Resolver<RoleDescriptor,,CriteriaSet> RoleDescriptorResolver
public class PredicateRoleDescriptorResolver
extends AbstractIdentifiedInitializableComponent
implements RoleDescriptorResolver
Implementation of
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CriterionPredicateRegistry<RoleDescriptor>Registry used in resolving predicates from criteria.private MetadataResolverResolver of EntityDescriptors.Predicate for evaluating whether a TimeboundSAMLObject is valid.private org.slf4j.LoggerLogger.private booleanWhether metadata is required to be valid.private booleanFlag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.private booleanFlag which determines whether predicates used in filtering are connected by a logical 'OR' (true) or by logical 'AND' (false).private booleanFlag which determines whether the default predicate registry will be used if no one is supplied explicitly. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidSubclasses 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.Get the registry used in resolving predicates from criteria.protected booleanhaveRoleCriteria(CriteriaSet criteria) Determine if have entity role criteria.booleanGets whether the metadata returned by queries must be valid.booleanGet the flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.booleanGet the flag indicating whether resolved credentials may satisfy any predicates (i.e.booleanGet 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 filteredIterable.resolve(CriteriaSet criteria) resolveSingle(CriteriaSet criteria) voidSet the registry used in resolving predicates from criteria.voidsetRequireValidMetadata(boolean require) Sets whether the metadata returned by queries must be valid.voidsetResolveViaPredicatesOnly(boolean flag) Set the flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.voidsetSatisfyAnyPredicates(boolean flag) Set the flag indicating whether resolved credentials may satisfy any predicates (i.e.voidsetUseDefaultPredicateRegistry(boolean flag) Set the flag which determines whether the default predicate registry will be used if one is not supplied explicitly.Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, setIdMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getId
-
Field Details
-
IS_VALID_PREDICATE
Predicate for evaluating whether a TimeboundSAMLObject is valid. -
log
@Nonnull private org.slf4j.Logger logLogger. -
requireValidMetadata
private boolean requireValidMetadataWhether metadata is required to be valid. -
entityDescriptorResolver
Resolver of EntityDescriptors. -
satisfyAnyPredicates
private boolean satisfyAnyPredicatesFlag which determines whether predicates used in filtering are connected by a logical 'OR' (true) or by logical 'AND' (false). Defaults to false. -
criterionPredicateRegistry
Registry used in resolving predicates from criteria. -
useDefaultPredicateRegistry
private boolean useDefaultPredicateRegistryFlag which determines whether the default predicate registry will be used if no one is supplied explicitly. Defaults to true. -
resolveViaPredicatesOnly
private boolean resolveViaPredicatesOnlyFlag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection. Defaults to false.
-
-
Constructor Details
-
PredicateRoleDescriptorResolver
public PredicateRoleDescriptorResolver(@Nonnull @ParameterName(name="mdResolver") MetadataResolver mdResolver) Constructor.- Parameters:
mdResolver- the resolver of EntityDescriptors
-
-
Method Details
-
isRequireValidMetadata
public boolean isRequireValidMetadata()Gets whether the metadata returned by queries must be valid. At a minimum, metadata is valid only if the date expressed in the element, and all its ancestral element's, validUntil attribute has not passed. Specific implementations may add additional constraints.- Specified by:
isRequireValidMetadatain interfaceRoleDescriptorResolver- Returns:
- whether the metadata returned by queries must be valid
-
setRequireValidMetadata
public void setRequireValidMetadata(boolean require) Sets whether the metadata returned by queries must be valid.- Specified by:
setRequireValidMetadatain interfaceRoleDescriptorResolver- Parameters:
require- whether the metadata returned by queries must be valid
-
isSatisfyAnyPredicates
public boolean isSatisfyAnyPredicates()Get the flag indicating whether resolved credentials may satisfy any predicates (i.e. connected by logical 'OR') or all predicates (connected by logical 'AND').Defaults to false.
- Returns:
- true if must satisfy all, false otherwise
-
setSatisfyAnyPredicates
public void setSatisfyAnyPredicates(boolean flag) Set the flag indicating whether resolved credentials may satisfy any predicates (i.e. connected by logical 'OR') or all predicates (connected by logical 'AND').Defaults to false.
- Parameters:
flag- true if must satisfy all, false otherwise
-
getCriterionPredicateRegistry
Get the registry used in resolving predicates from criteria.- Returns:
- the effective registry instance used
-
isUseDefaultPredicateRegistry
public boolean isUseDefaultPredicateRegistry()Get the flag which determines whether the default predicate registry will be used if one is not supplied explicitly.Defaults to true.
- Returns:
- true if should use default registry, false otherwise
-
setUseDefaultPredicateRegistry
public void setUseDefaultPredicateRegistry(boolean flag) Set the flag which determines whether the default predicate registry will be used if one is not supplied explicitly.Defaults to true.
- Parameters:
flag- true if should use default registry, false otherwise
-
isResolveViaPredicatesOnly
public boolean isResolveViaPredicatesOnly()Get the flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.- Returns:
- true if resolution may be attempted solely via predicates, false if not
-
setResolveViaPredicatesOnly
public void setResolveViaPredicatesOnly(boolean flag) Set the flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.- Parameters:
flag- true if resolution may be attempted solely via predicates, false if not
-
doInitialize
Subclasses should override this method to perform any initialization logic necessary. Default implementation is a no-op.- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException- thrown if there is a problem initializing the provider
-
getAllCandidates
@Nonnull protected Iterable<RoleDescriptor> getAllCandidates(@Nonnull Iterable<EntityDescriptor> entityDescriptors) Obtain all role descriptors contained by the input entity descriptors.- Parameters:
entityDescriptors- the entity descriptors on which to operate- Returns:
- all role descriptors contained by the input entity descriptors
-