Class RegisteredServiceMappedRegexAttributeFilter

  • All Implemented Interfaces:
    java.io.Serializable, org.apereo.cas.services.RegisteredServiceAttributeFilter, org.springframework.core.Ordered
    Direct Known Subclasses:
    RegisteredServiceMutantRegexAttributeFilter, RegisteredServiceReverseMappedRegexAttributeFilter

    public class RegisteredServiceMappedRegexAttributeFilter
    extends java.lang.Object
    implements org.apereo.cas.services.RegisteredServiceAttributeFilter
    A filtering policy that selectively applies patterns to attributes mapped in the config. If an attribute is mapped, it's only allowed to be released if it matches the linked pattern. If an attribute is not mapped, it may optionally be excluded from the released set of attributes.
    Since:
    5.1.0
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from interface org.springframework.core.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void collectAttributeWithFilteredValues​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributesToRelease, java.lang.String attributeName, java.util.List<java.lang.Object> filteredValues)
      Collect attribute with filtered values.
      protected java.util.Collection<java.util.regex.Pattern> createPatternForMappedAttribute​(java.lang.String attributeName)
      Create pattern for mapped attribute pattern.
      java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> filter​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> givenAttributes)  
      protected java.util.List<java.lang.Object> filterAttributeValuesByPattern​(java.util.Set<java.lang.Object> attributeValues, java.util.regex.Pattern pattern)
      Filter attribute values by pattern and return the list.
      protected java.util.function.Predicate<java.util.Map.Entry<java.lang.String,​java.util.List<java.lang.Object>>> filterProvidedGivenAttributes()
      Filter provided given attributes predicate.
      protected void handleUnmappedAttribute​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributesToRelease, java.lang.String attributeName, java.lang.Object attributeValue)
      Handle unmapped attribute.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apereo.cas.services.RegisteredServiceAttributeFilter

        getOrder
    • Constructor Detail

      • RegisteredServiceMappedRegexAttributeFilter

        public RegisteredServiceMappedRegexAttributeFilter​(java.util.Map<java.lang.String,​java.lang.Object> patterns)
    • Method Detail

      • filter

        public java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> filter​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> givenAttributes)
        Specified by:
        filter in interface org.apereo.cas.services.RegisteredServiceAttributeFilter
      • handleUnmappedAttribute

        protected void handleUnmappedAttribute​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributesToRelease,
                                               java.lang.String attributeName,
                                               java.lang.Object attributeValue)
        Handle unmapped attribute.
        Parameters:
        attributesToRelease - the attributes to release
        attributeName - the attribute name
        attributeValue - the attribute value
      • createPatternForMappedAttribute

        protected java.util.Collection<java.util.regex.Pattern> createPatternForMappedAttribute​(java.lang.String attributeName)
        Create pattern for mapped attribute pattern.
        Parameters:
        attributeName - the attribute name
        Returns:
        the pattern
      • collectAttributeWithFilteredValues

        protected void collectAttributeWithFilteredValues​(java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributesToRelease,
                                                          java.lang.String attributeName,
                                                          java.util.List<java.lang.Object> filteredValues)
        Collect attribute with filtered values.
        Parameters:
        attributesToRelease - the attributes to release
        attributeName - the attribute name
        filteredValues - the filtered values
      • filterProvidedGivenAttributes

        protected java.util.function.Predicate<java.util.Map.Entry<java.lang.String,​java.util.List<java.lang.Object>>> filterProvidedGivenAttributes()
        Filter provided given attributes predicate.
        Returns:
        the predicate
      • filterAttributeValuesByPattern

        protected java.util.List<java.lang.Object> filterAttributeValuesByPattern​(java.util.Set<java.lang.Object> attributeValues,
                                                                                  java.util.regex.Pattern pattern)
        Filter attribute values by pattern and return the list.
        Parameters:
        attributeValues - the attribute values
        pattern - the pattern
        Returns:
        the list