Class AttributeTranscoderRegistryImpl
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.transcoding.impl.AttributeTranscoderRegistryImpl
- All Implemented Interfaces:
AttributeTranscoderRegistry,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent,Aware,ApplicationContextAware
@ThreadSafe
public class AttributeTranscoderRegistryImpl
extends AbstractIdentifiableInitializableComponent
implements AttributeTranscoderRegistry, ApplicationContextAware
Service implementation of the
AttributeTranscoderRegistry interface.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
AttributeTranscoderRegistry.NamingFunction<T extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ApplicationContextThe context used to load this bean.Registry of description mappings associated with internal attribute IDs.Registry of display name mappings associated with internal attribute IDs.Optional factory function for building extended activation conditions.private final org.slf4j.LoggerClass logger.Registry of naming functions for supported object types.private final Map<String,Multimap<Class<?>, TranscodingRule>> Registry of transcoding instructions for a given "name" and type of object.Fields inherited from interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
PROP_CONDITION, PROP_DECODER, PROP_DESCRIPTION, PROP_DISPLAY_NAME, PROP_ENCODER, PROP_ID, PROP_RELYINGPARTIES, PROP_TRANSCODER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddMapping(String id, AttributeTranscoder<?> transcoder, Map<String, Object> ruleset) Add a mapping between anIdPAttributename and a set of transcoding rules.private Predicate<ProfileRequestContext>buildActivationCondition(Map<String, Object> ruleset) Build an appropriatePredicateto use as an activation condition within the ruleset.Get the context used to load this bean.private Collection<AttributeTranscoder<?>>Get the appropriateAttributeTranscoderobjects to use.getDescriptions(IdPAttribute attribute) getDisplayNames(IdPAttribute attribute) private Class<?>getEffectiveType(Class<?> inputType) Convert an input type into the appropriate type (possibly itself) to use in looking up rules in the registry.getTranscodingRules(IdPAttribute from, Class<?> to) getTranscodingRules(T from) voidsetApplicationContext(ApplicationContext context) voidSet a factory function to call to consume a rule set and produce an optional "extended" activation conditionPredicate.voidInstalls registry of naming functions mapped against the types of objects they support.voidsetTranscoderRegistry(Collection<TranscodingRule> mappings) Installs the transcoder mappings en masse.Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
doInitialize, ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods 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
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
transcodingRegistry
Registry of transcoding instructions for a given "name" and type of object. -
displayNameRegistry
Registry of display name mappings associated with internal attribute IDs. -
descriptionRegistry
Registry of description mappings associated with internal attribute IDs. -
namingFunctionRegistry
Registry of naming functions for supported object types. -
extendedConditionFactory
@Nullable private Function<Map<String,Object>, extendedConditionFactoryPredicate<ProfileRequestContext>> Optional factory function for building extended activation conditions. -
applicationContext
The context used to load this bean.
-
-
Constructor Details
-
AttributeTranscoderRegistryImpl
public AttributeTranscoderRegistryImpl()Constructor.
-
-
Method Details
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware
-
getApplicationContext
Get the context used to load this bean.- Returns:
- the context.
-
setNamingRegistry
public void setNamingRegistry(@Nullable Collection<AttributeTranscoderRegistry.NamingFunction<?>> registry) Installs registry of naming functions mapped against the types of objects they support.- Parameters:
registry- collection of naming functions for indexing
-
setTranscoderRegistry
Installs the transcoder mappings en masse.Each map connects an
IdPAttributename to the rules for transcoding to/from it.The rules MUST contain at least:
AttributeTranscoderRegistry.PROP_ID- internal attribute ID to map to/fromAttributeTranscoderRegistry.PROP_TRANSCODER- anAttributeTranscoderinstance supporting the type
- Parameters:
mappings- transcoding rulesets
-
setExtendedConditionFactory
public void setExtendedConditionFactory(@Nullable Function<Map<String, Object>, Predicate<ProfileRequestContext>> factory) Set a factory function to call to consume a rule set and produce an optional "extended" activation conditionPredicate.This allows deployments to define extended property names that represent condition types not known to this layer of the code base.
- Parameters:
factory- factory function
-
getDisplayNames
@Nonnull @NotLive @Unmodifiable public Map<Locale,String> getDisplayNames(@Nonnull IdPAttribute attribute) - Specified by:
getDisplayNamesin interfaceAttributeTranscoderRegistry
-
getDescriptions
@Nonnull @NotLive @Unmodifiable public Map<Locale,String> getDescriptions(@Nonnull IdPAttribute attribute) - Specified by:
getDescriptionsin interfaceAttributeTranscoderRegistry
-
getTranscodingRules
@Nonnull @Unmodifiable @NotLive public Collection<TranscodingRule> getTranscodingRules(@Nonnull IdPAttribute from, @Nonnull Class<?> to) - Specified by:
getTranscodingRulesin interfaceAttributeTranscoderRegistry
-
getTranscodingRules
@Nonnull @Unmodifiable @NotLive public <T> Collection<TranscodingRule> getTranscodingRules(@Nonnull T from) - Specified by:
getTranscodingRulesin interfaceAttributeTranscoderRegistry
-
getAttributeTranscoders
@Nonnull private Collection<AttributeTranscoder<?>> getAttributeTranscoders(@Nonnull TranscodingRule rule) Get the appropriateAttributeTranscoderobjects to use.- Parameters:
rule- transcoding rule- Returns:
- transcoders to install under a copy of each ruleset's
AttributeTranscoderRegistry.PROP_TRANSCODERproperty
-
addMapping
private void addMapping(@Nonnull @NotEmpty String id, @Nonnull AttributeTranscoder<?> transcoder, @Nonnull Map<String, Object> ruleset) Add a mapping between anIdPAttributename and a set of transcoding rules.- Parameters:
id- name of theIdPAttributeto map to/fromtranscoder- the transcoder for this ruleruleset- transcoding rules
-
buildActivationCondition
@Nullable private Predicate<ProfileRequestContext> buildActivationCondition(@Nonnull Map<String, Object> ruleset) Build an appropriatePredicateto use as an activation condition within the ruleset.- Parameters:
ruleset- transcoding rules- Returns:
- a predicate to install under the ruleset's
AttributeTranscoderRegistry.PROP_CONDITION
-
getEffectiveType
Convert an input type into the appropriate type (possibly itself) to use in looking up rules in the registry.- Parameters:
inputType- the type passed into the registry operation- Returns:
- the appropriate type to use subsequently or null if not found
-