Class AbstractMetadataDrivenConfigurationLookupStrategy<T>
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.config.AbstractMetadataDrivenConfigurationLookupStrategy<T>
- Type Parameters:
T- type of property being returned
- All Implemented Interfaces:
Function<BaseContext,,T> Component,DestructableComponent,InitializableComponent
- Direct Known Subclasses:
AbstractCollectionConfigurationLookupStrategy,BeanConfigurationLookupStrategy,BooleanConfigurationLookupStrategy,DoubleConfigurationLookupStrategy,DurationConfigurationLookupStrategy,IntegerConfigurationLookupStrategy,LongConfigurationLookupStrategy,StringConfigurationLookupStrategy
public abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T>
extends AbstractInitializableComponent
implements Function<BaseContext,T>
A strategy function that examines SAML metadata associated with a relying party and derives configuration
settings based on EntityAttribute extension tags.
The function is tailored with properties that determine what tag it looks for, with subclasses handling the specific type conversion logic.
If a specific property is unavailable, then null is returned.
- Since:
- 5.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA child context that caches derived configuration properties. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Function<MessageContext,String> Default profile ID lookup for MC-based usage.private static final Function<ProfileRequestContext,String> Default profile ID lookup for PRC-based usage.private Function<BaseContext,T> Default to return in the absence of a property.private booleanCache the lookup in the context tree.private booleanPrevents prefixing of property name by profile/aliases.private booleanExamine only decoded/mapped tags in object metadata.private Collection<String>Legacy "full" property identifiers to support.private StringLegacy name of property to check for (will warn).private static final org.slf4j.LoggerClass logger.private Function<MessageContext,EntityDescriptor> Strategy for obtaining metadata via MessageContext.private Function<BaseContext,String> Strategy for obtaining profile ID for property naming.Strategy for obtaining metadata via ProfileRequestContext.private Collection<String>The "full" property identifiers to support.private StringBase name of property to check for.private booleanRequire use of URI attribute name format. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(BaseContext input) protected voidprotected abstract TdoTranslate(IdPAttribute tag) Translate the value(s) into a setting of the appropriate type.protected abstract TdoTranslate(Attribute tag) Translate the value(s) into a setting of the appropriate type.private StringGets the "base" name of the property/setting to derive.private IdPAttributefindMatchingMappedTag(LockableClassToInstanceMultiMap<?> input, String name) Find first matching attribute in the input object's node metadata.private IdPAttributefindMatchingMappedTag(EntityDescriptor entity, String name) Find first matching attribute in the input object's node metadata.private AttributefindMatchingTag(EntityAttributes entityAttributes, String name) Find a matching entity attribute in the input metadata.private AttributefindMatchingTag(EntityDescriptor entity, String name) Find a matching entity attribute in the input metadata.processMappedTag(IdPAttribute tag, AbstractMetadataDrivenConfigurationLookupStrategy.CachedConfigurationContext cacheContext) Process a mapped tag by returning any value found and caching if necessary.processTag(Attribute tag, AbstractMetadataDrivenConfigurationLookupStrategy.CachedConfigurationContext cacheContext) Process a tag by returning any value found and caching if necessary.voidsetDefaultValue(T value) Sets a default value to return as the function result in the absence of an explicit property.voidsetDefaultValueStrategy(Function<BaseContext, T> strategy) Sets a default value function to apply in the absence of an explicit property.voidsetEnableCaching(boolean flag) Sets whether property lookup should be cached in the profile context tree.voidsetExplicitPropertyName(boolean flag) Sets whether to treat the property name as absolute instead of auto-prefixed by profile or alias values.voidsetIgnoreUnmappedEntityAttributes(boolean flag) Sets whether property lookup should be based solely on mapped/decoded objects and not on underlying SAML Attributes.voidsetLegacyPropertyName(String name) Sets a legacy "base" name of the property/setting to derive.voidSets lookup strategy for metadata to examine by way ofMessageContext.voidsetProfileAliases(Collection<String> aliases) Sets profile ID aliases to include when checking for metadata tags (the property name is suffixed to the aliases).voidsetProfileIdLookupStrategy(Function<BaseContext, String> strategy) Sets lookup strategy for profile ID to base property names on.voidSets lookup strategy for metadata to examine by way ofProfileRequestContext.voidsetPropertyName(String name) Sets the "base" name of the property/setting to derive.voidsetStrictNameFormat(boolean flag) Sets whether tag matching should examine and require an Attribute NameFormat of the URI type.private Ttranslate(IdPAttribute tag) Translate the value(s) into a setting of the appropriate type.private TTranslate the value(s) into a setting of the appropriate type.Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
-
Field Details
-
DEFAULT_PRC_PROFILE_ID_LOOKUP
Default profile ID lookup for PRC-based usage. -
DEFAULT_MC_PROFILE_ID_LOOKUP
Default profile ID lookup for MC-based usage. -
LOG
@Nonnull private static final org.slf4j.Logger LOGClass logger. -
strictNameFormat
private boolean strictNameFormatRequire use of URI attribute name format. -
enableCaching
private boolean enableCachingCache the lookup in the context tree. -
ignoreUnmappedEntityAttributes
private boolean ignoreUnmappedEntityAttributesExamine only decoded/mapped tags in object metadata. -
explicitPropertyName
private boolean explicitPropertyNamePrevents prefixing of property name by profile/aliases. -
propertyName
Base name of property to check for. -
legacyPropertyName
Legacy name of property to check for (will warn). -
propertyAliases
The "full" property identifiers to support. -
legacyPropertyAliases
Legacy "full" property identifiers to support. -
defaultValueStrategy
Default to return in the absence of a property. -
profileMetadataLookupStrategy
Strategy for obtaining metadata via ProfileRequestContext. -
messageMetadataLookupStrategy
Strategy for obtaining metadata via MessageContext. -
profileIdLookupStrategy
Strategy for obtaining profile ID for property naming.
-
-
Constructor Details
-
AbstractMetadataDrivenConfigurationLookupStrategy
public AbstractMetadataDrivenConfigurationLookupStrategy()Constructor.
-
-
Method Details
-
setStrictNameFormat
public void setStrictNameFormat(boolean flag) Sets whether tag matching should examine and require an Attribute NameFormat of the URI type.Default is false.
- Parameters:
flag- flag to set
-
setEnableCaching
public void setEnableCaching(boolean flag) Sets whether property lookup should be cached in the profile context tree.Default is true.
- Parameters:
flag- flag to set
-
setIgnoreUnmappedEntityAttributes
public void setIgnoreUnmappedEntityAttributes(boolean flag) Sets whether property lookup should be based solely on mapped/decoded objects and not on underlying SAML Attributes.Default is false.
- Parameters:
flag- flag to set
-
setExplicitPropertyName
public void setExplicitPropertyName(boolean flag) Sets whether to treat the property name as absolute instead of auto-prefixed by profile or alias values.Used to allow for direct lookup of a specific tag instead implicitly prefixing the tag name based on configuration "context".
- Parameters:
flag- flag to set- Since:
- 4.3.0
-
ensurePropertyName
Gets the "base" name of the property/setting to derive.Callable only after init.
- Returns:
- property name
-
setPropertyName
Sets the "base" name of the property/setting to derive.- Parameters:
name- base property name
-
setLegacyPropertyName
Sets a legacy "base" name of the property/setting to derive.Use of this name will trigger a deprecation warning.
- Parameters:
name- base property name
-
setProfileAliases
Sets profile ID aliases to include when checking for metadata tags (the property name is suffixed to the aliases).This allows alternatively-prefixed tag names to be checked.
- Parameters:
aliases- alternative profile IDs
-
setDefaultValue
Sets a default value to return as the function result in the absence of an explicit property.- Parameters:
value- default value to return
-
setDefaultValueStrategy
Sets a default value function to apply in the absence of an explicit property.- Parameters:
strategy- default function to apply- Since:
- 4.0.0
-
setProfileMetadataLookupStrategy
public void setProfileMetadataLookupStrategy(@Nonnull Function<ProfileRequestContext, EntityDescriptor> strategy) Sets lookup strategy for metadata to examine by way ofProfileRequestContext.- Parameters:
strategy- lookup strategy
-
setMessageMetadataLookupStrategy
public void setMessageMetadataLookupStrategy(@Nonnull Function<MessageContext, EntityDescriptor> strategy) Sets lookup strategy for metadata to examine by way ofMessageContext.- Parameters:
strategy- lookup strategy
-
setProfileIdLookupStrategy
Sets lookup strategy for profile ID to base property names on.- Parameters:
strategy- lookup strategy
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
apply
- Specified by:
applyin interfaceFunction<BaseContext,T>
-
translate
Translate the value(s) into a setting of the appropriate type.- Parameters:
tag- tag to translate- Returns:
- the setting derived from the tag's value(s)
-
translate
Translate the value(s) into a setting of the appropriate type.- Parameters:
tag- tag to translate- Returns:
- the setting derived from the tag's value(s)
-
doTranslate
Translate the value(s) into a setting of the appropriate type.Overrides of this function can assume a non-zero collection of values.
- Parameters:
tag- tag to translate- Returns:
- the setting derived from the tag's value(s)
-
doTranslate
Translate the value(s) into a setting of the appropriate type.Overrides of this function can assume a non-zero collection of values.
- Parameters:
tag- tag to translate- Returns:
- the setting derived from the tag's value(s)
-
processMappedTag
@Nullable private Optional<T> processMappedTag(@Nullable IdPAttribute tag, @Nullable AbstractMetadataDrivenConfigurationLookupStrategy.CachedConfigurationContext cacheContext) Process a mapped tag by returning any value found and caching if necessary.- Parameters:
tag- the mapped tag objectcacheContext- cache context- Returns:
- a possibly empty
Optionalcontaining the value if any, or null
-
processTag
@Nullable private Optional<T> processTag(@Nullable Attribute tag, @Nullable AbstractMetadataDrivenConfigurationLookupStrategy.CachedConfigurationContext cacheContext) Process a tag by returning any value found and caching if necessary.- Parameters:
tag- the tag objectcacheContext- cache context- Returns:
- a possibly empty
Optionalcontaining the value if any, or null
-
findMatchingMappedTag
@Nullable private IdPAttribute findMatchingMappedTag(@Nonnull EntityDescriptor entity, @Nonnull @NotEmpty String name) Find first matching attribute in the input object's node metadata.- Parameters:
entity- the metadata to examinename- the tag name to search for- Returns:
- matching attribute, or null
-
findMatchingTag
@Nullable private Attribute findMatchingTag(@Nonnull EntityDescriptor entity, @Nonnull @NotEmpty String name) Find a matching entity attribute in the input metadata.- Parameters:
entity- the metadata to examinename- the tag name to search for- Returns:
- matching attribute or null
-
findMatchingTag
@Nullable private Attribute findMatchingTag(@Nonnull EntityAttributes entityAttributes, @Nonnull @NotEmpty String name) Find a matching entity attribute in the input metadata.- Parameters:
entityAttributes- the metadata to examinename- the tag name to search for- Returns:
- matching attribute or null
-