Class AttributeTranscoderRegistryImpl

  • All Implemented Interfaces:
    net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry, net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.IdentifiableComponent, net.shibboleth.utilities.java.support.component.IdentifiedComponent, net.shibboleth.utilities.java.support.component.InitializableComponent, net.shibboleth.utilities.java.support.service.ServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>, Aware, ApplicationContextAware

    @ThreadSafe
    public class AttributeTranscoderRegistryImpl
    extends net.shibboleth.ext.spring.service.AbstractServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>
    implements net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
    Service implementation of the AttributeTranscoderRegistry interface.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void addMapping​(String id, net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<?> transcoder, Map<String,​Object> ruleset)
      Add a mapping between an IdPAttribute name and a set of transcoding rules.
      private Predicate<org.opensaml.profile.context.ProfileRequestContext> buildActivationCondition​(Map<String,​Object> ruleset)
      Build an appropriate Predicate to use as an activation condition within the ruleset.
      private Collection<net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<?>> getAttributeTranscoders​(net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
      Get the appropriate AttributeTranscoder objects to use.
      net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry getComponent()
      Map<Locale,​String> getDescriptions​(net.shibboleth.idp.attribute.IdPAttribute attribute)
      Map<Locale,​String> getDisplayNames​(net.shibboleth.idp.attribute.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.
      Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> getTranscodingRules​(net.shibboleth.idp.attribute.IdPAttribute from, Class<?> to)
      <T> Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> getTranscodingRules​(T from)
      void setNamingRegistry​(Map<Class<?>,​Function<?,​String>> registry)
      Installs registry of naming functions mapped against the types of objects they support.
      void setTranscoderRegistry​(Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> mappings)
      Installs the transcoder mappings en masse.
      • Methods inherited from class net.shibboleth.ext.spring.service.AbstractServiceableComponent

        doDestroy, doInitialize, getApplicationContext, pinComponent, setApplicationContext, unloadComponent, unpinComponent
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent

        setId
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent

        getId
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent

        destroy, initialize, isDestroyed, isInitialized
      • Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent

        getId
    • Field Detail

      • log

        @Nonnull
        private final Logger log
        Class logger.
      • transcodingRegistry

        @Nonnull
        @NonnullElements
        private final Map<String,​Multimap<Class<?>,​net.shibboleth.idp.attribute.transcoding.TranscodingRule>> transcodingRegistry
        Registry of transcoding instructions for a given "name" and type of object.
      • displayNameRegistry

        @Nonnull
        @NonnullElements
        private final Map<String,​Map<Locale,​String>> displayNameRegistry
        Registry of display name mappings associated with internal attribute IDs.
      • descriptionRegistry

        @Nonnull
        @NonnullElements
        private final Map<String,​Map<Locale,​String>> descriptionRegistry
        Registry of description mappings associated with internal attribute IDs.
      • namingFunctionRegistry

        @Nonnull
        @NonnullElements
        private final Map<Class<?>,​Function<?,​String>> namingFunctionRegistry
        Registry of naming functions for supported object types.
    • Constructor Detail

      • AttributeTranscoderRegistryImpl

        public AttributeTranscoderRegistryImpl()
        Constructor.
    • Method Detail

      • getComponent

        @Nonnull
        public net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry getComponent()
        Specified by:
        getComponent in interface net.shibboleth.utilities.java.support.service.ServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>
        Specified by:
        getComponent in class net.shibboleth.ext.spring.service.AbstractServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>
      • setNamingRegistry

        public void setNamingRegistry​(@Nonnull @NonnullElements
                                      Map<Class<?>,​Function<?,​String>> registry)
        Installs registry of naming functions mapped against the types of objects they support.
        Parameters:
        registry - map of types to naming functions
      • setTranscoderRegistry

        public void setTranscoderRegistry​(@Nonnull @NonnullElements
                                          Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> mappings)
        Installs the transcoder mappings en masse.

        Each map connects an IdPAttribute name to the rules for transcoding to/from it.

        The rules MUST contain at least:

        • AttributeTranscoderRegistry.PROP_ID - internal attribute ID to map to/from
        • AttributeTranscoderRegistry.PROP_TRANSCODER - an AttributeTranscoder instance supporting the type
        Transcoders will generally require particular properties in their own right to function.
        Parameters:
        mappings - transcoding rulesets
      • getDisplayNames

        @Nonnull
        @NonnullElements
        @NotLive
        @Unmodifiable
        public Map<Locale,​String> getDisplayNames​(@Nonnull
                                                        net.shibboleth.idp.attribute.IdPAttribute attribute)
        Specified by:
        getDisplayNames in interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
      • getDescriptions

        @Nonnull
        @NonnullElements
        @NotLive
        @Unmodifiable
        public Map<Locale,​String> getDescriptions​(@Nonnull
                                                        net.shibboleth.idp.attribute.IdPAttribute attribute)
        Specified by:
        getDescriptions in interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
      • getTranscodingRules

        @Nonnull
        @NonnullElements
        @Unmodifiable
        public Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> getTranscodingRules​(@Nonnull
                                                                                                        net.shibboleth.idp.attribute.IdPAttribute from,
                                                                                                        @Nonnull
                                                                                                        Class<?> to)
        Specified by:
        getTranscodingRules in interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
      • getTranscodingRules

        @Nonnull
        @NonnullElements
        @Unmodifiable
        public <T> Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> getTranscodingRules​(@Nonnull
                                                                                                            T from)
        Specified by:
        getTranscodingRules in interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
      • getAttributeTranscoders

        @Nonnull
        @NonnullElements
        private Collection<net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<?>> getAttributeTranscoders​(@Nonnull
                                                                                                                    net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
        Get the appropriate AttributeTranscoder objects to use.
        Parameters:
        rule - transcoding rule
        Returns:
        transcoders to install under a copy of each ruleset's AttributeTranscoderRegistry.PROP_TRANSCODER property
      • addMapping

        private void addMapping​(@Nonnull @NotEmpty
                                String id,
                                @Nonnull
                                net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<?> transcoder,
                                @Nonnull
                                Map<String,​Object> ruleset)
        Add a mapping between an IdPAttribute name and a set of transcoding rules.
        Parameters:
        id - name of the IdPAttribute to map to/from
        transcoder - the transcoder for this rule
        ruleset - transcoding rules
      • buildActivationCondition

        @Nullable
        private Predicate<org.opensaml.profile.context.ProfileRequestContext> buildActivationCondition​(@Nonnull
                                                                                                       Map<String,​Object> ruleset)
        Build an appropriate Predicate to 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

        @Nullable
        private Class<?> getEffectiveType​(@Nonnull
                                          Class<?> inputType)
        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