Class AllowDenyMatcherUtil
- java.lang.Object
-
- com.composum.ai.backend.slingbase.impl.AllowDenyMatcherUtil
-
public class AllowDenyMatcherUtil extends Object
Utilities for matching allow / deny String[] pattern collections.
-
-
Constructor Summary
Constructors Constructor Description AllowDenyMatcherUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
allowDenyCheck(String value, Pattern allowPattern, Pattern denyPattern)
Check whether a value matches the allowPattern but not the denyPattern.static Pattern
joinPatternsIntoAnyMatcher(String[] patterns)
Makes a pattern that matches whenever one of the patterns matches the input.static boolean
matchesAny(String value, String[] patterns)
static boolean
matchesAny(String value, List<String> patterns)
static List<String>
userAndGroupsOfUser(org.apache.sling.api.SlingHttpServletRequest request)
Collects the username and all groups the user belongs to (either explicitly or inherited).
-
-
-
Method Detail
-
joinPatternsIntoAnyMatcher
@Nullable public static Pattern joinPatternsIntoAnyMatcher(@Nullable String[] patterns)
Makes a pattern that matches whenever one of the patterns matches the input. If no patterns are given, we return null.
-
allowDenyCheck
public static boolean allowDenyCheck(@Nullable String value, @Nullable Pattern allowPattern, @Nullable Pattern denyPattern)
Check whether a value matches the allowPattern but not the denyPattern. Thouse could be created withjoinPatternsIntoAnyMatcher(String[])
. If allowPattern is null it will never match. If denyPattern is null it is ignored, just the allowPattern matters.- See Also:
joinPatternsIntoAnyMatcher(String[])
-
-