Class AbstractMetadataDrivenConfigurationLookupStrategy<T>

    • Field Detail

      • DEFAULT_PRC_PROFILE_ID_LOOKUP

        @Nonnull
        private static final Function<ProfileRequestContext,​String> DEFAULT_PRC_PROFILE_ID_LOOKUP
        Default profile ID lookup for PRC-based usage.
      • DEFAULT_MC_PROFILE_ID_LOOKUP

        @Nonnull
        private static final Function<MessageContext,​String> DEFAULT_MC_PROFILE_ID_LOOKUP
        Default profile ID lookup for MC-based usage.
      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • strictNameFormat

        private boolean strictNameFormat
        Require use of URI attribute name format.
      • enableCaching

        private boolean enableCaching
        Cache the lookup in the context tree.
      • ignoreUnmappedEntityAttributes

        private boolean ignoreUnmappedEntityAttributes
        Examine only decoded/mapped tags in object metadata.
      • explicitPropertyName

        private boolean explicitPropertyName
        Prevents prefixing of property name by profile/aliases.
      • defaultValueStrategy

        @Nullable
        private Function<BaseContext,​T> defaultValueStrategy
        Optional default to return in the absence of a property.
    • Constructor Detail

      • AbstractMetadataDrivenConfigurationLookupStrategy

        public AbstractMetadataDrivenConfigurationLookupStrategy()
        Constructor.
    • Method Detail

      • 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
      • setPropertyName

        public void setPropertyName​(@Nonnull @NotEmpty
                                    String name)
        Sets the "base" name of the property/setting to derive.
        Parameters:
        name - base property name
      • setProfileAliases

        public void setProfileAliases​(@Nonnull @NonnullElements
                                      Collection<String> aliases)
        Sets profile ID aliases to include when checking for metadata tags (the property name is suffixed to the aliases).

        This allows alternative tag names to be checked.

        Parameters:
        aliases - alternative profile IDs
      • setDefaultValue

        public void setDefaultValue​(@Nullable
                                    T value)
        Sets a default value to return as the function result in the absence of an explicit property.
        Parameters:
        value - default value to return
      • setDefaultValueStrategy

        public void setDefaultValueStrategy​(@Nonnull
                                            Function<BaseContext,​T> strategy)
        Sets a default value function to apply in the absence of an explicit property.
        Parameters:
        strategy - default function to apply
        Since:
        4.0.0
      • setMetadataLookupStrategy

        public void setMetadataLookupStrategy​(@Nonnull
                                              Function<BaseContext,​EntityDescriptor> strategy)
        Sets lookup strategy for metadata to examine.
        Parameters:
        strategy - lookup strategy
      • setProfileIdLookupStrategy

        public void setProfileIdLookupStrategy​(@Nonnull
                                               Function<BaseContext,​String> strategy)
        Sets lookup strategy for profile ID to base property names on.
        Parameters:
        strategy - lookup strategy
      • translate

        @Nullable
        private T translate​(@Nonnull
                            Attribute tag)
        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

        @Nullable
        private T translate​(@Nonnull
                            IdPAttribute tag)
        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

        @Nullable
        protected abstract T doTranslate​(@Nonnull
                                         Attribute tag)
        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

        @Nullable
        protected abstract T doTranslate​(@Nonnull
                                         IdPAttribute tag)
        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)
      • 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 examine
        name - 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 examine
        name - the tag name to search for
        Returns:
        matching attribute or null
      • findMatchingMappedTag

        @Nullable
        private IdPAttribute findMatchingMappedTag​(@Nonnull
                                                   LockableClassToInstanceMultiMap<?> input,
                                                   @Nonnull @NotEmpty
                                                   String name)
        Find first matching attribute in the input object's node metadata.
        Parameters:
        input - the metadata to examine
        name - 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 examine
        name - the tag name to search for
        Returns:
        matching attribute or null