You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by an...@apache.org on 2018/10/31 14:32:58 UTC

svn commit: r1845334 - in /jackrabbit/oak/trunk: oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/ oak-doc/src/site/markdown/security/authorization/ oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/securi...

Author: angela
Date: Wed Oct 31 14:32:58 2018
New Revision: 1845334

URL: http://svn.apache.org/viewvc?rev=1845334&view=rev
Log:
OAK-7233 : Improve rep:glob documentation

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/GlobPatternTest.java
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/authorization/restriction.md
    jackrabbit/oak/trunk/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L8_GlobRestrictionTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/GlobPatternTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/GlobPatternTest.java?rev=1845334&r1=1845333&r2=1845334&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/GlobPatternTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/restriction/GlobPatternTest.java Wed Oct 31 14:32:58 2018
@@ -392,6 +392,24 @@ public class GlobPatternTest {
         for (String toTest : tests.keySet()) {
             assertTrue(gp + " : " + toTest, tests.get(toTest) == gp.matches(toTest));
         }
+
+        gp = GlobPattern.create("/a/b/c", "/d/");
+
+        tests = new HashMap<String,Boolean>();
+        tests.put("/", false);
+        tests.put("/a", false);
+        tests.put("/a/b/c", false);
+        tests.put("/a/b/c/d", false);
+        tests.put("/a/b/c/d/e", true);
+        tests.put("/a/b/c/d/e/f", true);
+        tests.put("/a/b/cd", false);
+        tests.put("/a/b/cd/e", false);
+        tests.put("/a/b/cd/e/f", false);
+        tests.put("/a/b/cde", false);
+
+        for (String toTest : tests.keySet()) {
+            assertTrue(gp + " : " + toTest, tests.get(toTest) == gp.matches(toTest));
+        }
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/authorization/restriction.md
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/authorization/restriction.md?rev=1845334&r1=1845333&r2=1845334&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/authorization/restriction.md (original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/authorization/restriction.md Wed Oct 31 14:32:58 2018
@@ -125,22 +125,38 @@ Oak 1.0 access control management:
 For a nodePath `/foo` the following results can be expected for the different
 values of `rep:glob`.
 
-| rep:glob          | Result                                                   |
-|-------------------|----------------------------------------------------------|
-| ""                | matches node /foo only                                   |
-| /cat              | the node /foo/cat and all it's children                  |
-| /cat/             | the descendants of the node /foo/cat                     |
-| cat               | the node /foocat and all it's children                   |
-| cat/              | all descendants of the node /foocat                      |
-| \*                | foo, siblings of foo and their descendants               |
-| /\*cat            | all children of /foo whose path ends with 'cat'          |
-| /\*/cat           | all non-direct descendants of /foo named 'cat'           |
-| /cat\*            | all descendant path of /foo that have the direct foo-descendant segment starting with 'cat' |
-| \*cat             | all siblings and descendants of foo that have a name ending with 'cat' |
-| \*/cat            | all descendants of /foo and foo's siblings that have a name segment 'cat' |
-| cat/\*            | all descendants of '/foocat'                             |
-| /cat/\*           | all descendants of '/foo/cat'                            |
-| \*cat/\*          | all descendants of /foo that have an intermediate segment ending with 'cat' |
+Please note that the pattern is based on simple path concatenation and equally applies to either type of item (both nodes and properties). 
+Consequently the examples below need to be adjusted for the root node in order to produce the desired effect. In particular a path with two subsequent / is invalid and will never match any target item or path.
+
+| rep:glob      | Result                                                   |
+|---------------|----------------------------------------------------------|
+| null          | i.e. no restriction: matches /foo and all children       |
+| ""            | matches node /foo only                                   |
+
+Examples including wildcard char:
+
+| rep:glob      | Result                                                   |
+|---------------|----------------------------------------------------------|
+| \*            | foo, siblings of foo and their descendants               |
+| /\*cat        | all child items of /foo whose paths end with 'cat'       |
+| \*cat         | all siblings and descendants of foo that have a name ending with 'cat' |
+| /\*/cat       | all non-direct descendants of /foo named 'cat'           |
+| /cat\*        | all descendant of /foo that have the direct foo-descendant segment starting with 'cat' |
+| \*/cat        | all descendants of /foo and foo's siblings that have a name segment 'cat' |
+| cat/\*        | all descendants of '/foocat'                             |
+| /cat/\*       | all descendants of '/foo/cat'                            |
+| /\*cat/\*     | all descendants of /foo that have an intermediate segment ending with 'cat' |
+
+Examples without wildcard char:
+
+| rep:glob      | Result                                                   |
+|---------------|----------------------------------------------------------|
+| /cat          |   the node /foo/cat and all it's child items             |
+| /cat/         |   the descendants of the node /foo/cat                   |
+| cat           |   the node /foocat and all it's child items              |
+| cat/          |   all descendants of the node /foocat                    |
+
+See also [GlobPattern] for implementation details.
 
 <a name="representation"/>
 ### Representation in the Repository
@@ -285,6 +301,7 @@ The time-based `RestrictionPattern` used
     Repository repo = new Jcr(new Oak()).with(securityProvider).createRepository();
 
 <!-- hidden references -->
+[GlobPattern]: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/GlobPattern.java?view=markup
 [Restriction]: /oak/docs/apidocs/org/apache/jackrabbit/oak/spi/security/authorization/restriction/Restriction.html
 [RestrictionDefinition]: /oak/docs/apidocs/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionDefinition.html
 [RestrictionPattern]: /oak/docs/apidocs/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionPattern.html

Modified: jackrabbit/oak/trunk/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L8_GlobRestrictionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L8_GlobRestrictionTest.java?rev=1845334&r1=1845333&r2=1845334&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L8_GlobRestrictionTest.java (original)
+++ jackrabbit/oak/trunk/oak-exercise/src/test/java/org/apache/jackrabbit/oak/exercise/security/authorization/accesscontrol/L8_GlobRestrictionTest.java Wed Oct 31 14:32:58 2018
@@ -16,7 +16,20 @@
  */
 package org.apache.jackrabbit.oak.exercise.security.authorization.accesscontrol;
 
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import com.google.common.collect.ImmutableSet;
 import org.apache.jackrabbit.oak.AbstractSecurityTest;
+import org.apache.jackrabbit.oak.spi.security.authorization.AuthorizationConfiguration;
+import org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.AccessControlConstants;
+import org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction;
+import org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionPattern;
+import org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider;
+import org.jetbrains.annotations.NotNull;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
 
 /**
  * <pre>
@@ -33,13 +46,24 @@ import org.apache.jackrabbit.oak.Abstrac
  *
  * Exercises:
  *
- * - {@link #TODO}
+ * For all tests fill in the expected result (matching, not-matching):
  *
- *
- * Additional Exercises:
- * -----------------------------------------------------------------------------
- *
- * TODO
+ * - {@link #testWildcard}
+ * - {@link #testWildcard2}
+ * - {@link #testWildcard3}
+ * - {@link #testWildcard4}
+ * - {@link #testWildcard5}
+ * - {@link #testWildcard6}
+ * - {@link #testWildcard7}
+ * - {@link #testWildcard8}
+ * - {@link #testWildcard9}
+ * - {@link #testWildcard10}
+ * - {@link #testWildcardOnRoot}
+ * - {@link #testEmptyOnRoot}
+ * - {@link #testEmpty}
+ * - {@link #testPath}
+ * - {@link #testPath2}
+ * - {@link #testPath3}
  *
  * </pre>
  *
@@ -47,5 +71,391 @@ import org.apache.jackrabbit.oak.Abstrac
  */
 public class L8_GlobRestrictionTest extends AbstractSecurityTest {
 
+    @Test
+    public void testWildcard() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c","*");
+        
+        // EXERCISE: fill-in the expected result for the match (true or true|false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|true|false);
+        tests.put("/a", true|true|false);
+        tests.put("/a/b/c", true|true|false);
+        tests.put("/a/b/c/d/e/f", true|true|false);
+        tests.put("/a/b/cde", true|true|false);
+        tests.put("/a/b/cde/e/f", true|true|false);
+        tests.put("/b/c", true|true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard2() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c","*e");
+        
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|false);
+        tests.put("/a", true|false);
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/c/e", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/gge", true|false);
+        tests.put("/a/b/c/d/gge", true|false);
+        tests.put("/a/b/ce", true|false);
+        tests.put("/a/b/ce/", true|false);
+        tests.put("/a/b/ceg", true|false);
+        tests.put("/a/b/chee", true|false);
+        tests.put("/a/b/cd/e", true|false);
+        tests.put("/a/b/cd/f/e", true|false);
+        tests.put("/a/b/cd/e", true|false);
+        tests.put("/a/b/cd/f/e", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/c/d/f/e/f", true|false);
+        tests.put("/a/b/c/d/f/efg", true|false);
+        tests.put("/a/b/c/d/f/f", true|false);
+        tests.put("/a/b/c/e/f", true|false);
+        tests.put("/b/c", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard3() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c","*/e");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|false);
+        tests.put("/a", true|false);
+        tests.put("/b/c", true|false);
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/c/e", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/e/f", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/d/f/f", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/c/d/f/e/f", true|false);
+        tests.put("/a/b/cd/e", true|false);
+        tests.put("/a/b/cd/f/e", true|false);
+        tests.put("/a/b/ce/", true|false);
+        tests.put("/a/b/c/d/f/efg", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard4() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c/e", "/*");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/e", true|false);
+        tests.put("/a/b/c/e/", true|false);
+        tests.put("/a/b/c/ef", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/c/d/f/f", true|false);
+        tests.put("/a/b/c/d/f/e/f", true|false);
+        tests.put("/a/b/cee/d/e/f", true|false);
+        tests.put("/a/b/ce/f/g/h", true|false);
+        tests.put("/a/b/c/e/f/g/h", true|false);
+        tests.put("/a/b/ce/d/e/f", true|false);
+        tests.put("/a/b/c/e/d/e/f", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard5() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "e/*");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/ce", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/c/d/f/f", true|false);
+        tests.put("/a/b/c/d/f/e/f", true|false);
+        tests.put("/a/b/ce/d/e/f", true|false);
+        tests.put("/a/b/cee/d/e/f", true|false);
+        tests.put("/a/b/ce/", true|false);
+        tests.put("/a/b/ce/f/g/h", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard6() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "*e/*");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/a/b/ce/", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/cde/d/e/f", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/ced/d/e/f", true|false);
+        tests.put("/a/b/cde", true|false);
+        tests.put("/a/b/c/d/e/", true|false);
+        tests.put("/a/b/c/d/f/f", true|false);
+        tests.put("/a/b/c/ed/f/f", true|false);
+        tests.put("/a/b/ceeeeeee/f/g/h", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard7() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "/*e/*");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/a/b/cde", true|false);
+        tests.put("/a/b/ced/d/e/f", true|false);
+        tests.put("/a/b/cde/d/e/f", true|false);
+        tests.put("/a/b/ce/", true|false);
+        tests.put("/a/b/c/d/e/", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/c/d/f/f", true|false);
+        tests.put("/a/b/c/de/f", true|false);
+        tests.put("/a/b/c/ed/f/f", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard8() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "/*cat");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/a/b/cat", true|false);
+        tests.put("/a/b/ced/cat", true|false);
+        tests.put("/a/b/c/cat", true|false);
+        tests.put("/a/b/c/acat", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/cat/e", true|false);
+        tests.put("/a/b/c/d/acat/e", true|false);
+        tests.put("/a/b/c/d/cata/e", true|false);
+        tests.put("/a/b/c/d/cate", true|false);
+        tests.put("/a/b/cat/ed/f/f", true|false);
+        tests.put("/a/b/c/f/cat", true|false);
+        tests.put("/a/b/c/f/acat", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard9() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "/*/cat");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/a/b/cat", true|false);
+        tests.put("/a/b/c/cat", true|false);
+        tests.put("/a/b/c/cate", true|false);
+        tests.put("/a/b/c/acat", true|false);
+        tests.put("/a/b/c/a/cat", true|false);
+        tests.put("/a/b/c/cat/d", true|false);
+        tests.put("/a/b/c/d/acat", true|false);
+        tests.put("/a/b/c/d/cate", true|false);
+        tests.put("/a/b/c/d/cat/e", true|false);
+        tests.put("/a/b/c/d/acat/e", true|false);
+        tests.put("/a/b/c/d/cata/e", true|false);
+        tests.put("/a/b/c/d/e/f/cat", true|false);
+        tests.put("/a/b/cat/ed/f/f", true|false);
+        tests.put("/a/b/ced/cat", true|false);
+        tests.put("/a/b/ced/f/cat", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcard10() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "/cat*");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/a/b/cat", true|false);
+        tests.put("/a/b/cat/ed/f/f", true|false);
+        tests.put("/a/b/ced/cat", true|false);
+        tests.put("/a/b/ced/f/cat", true|false);
+        tests.put("/a/b/c/cat", true | false);
+        tests.put("/a/b/c/cats", true|false);
+        tests.put("/a/b/c/d/cat", true|false);
+        tests.put("/a/b/c/d/cats", true|false);
+        tests.put("/a/b/c/d/e/cat", true|false);
+        tests.put("/a/b/c/d/e/cats", true|false);
+        tests.put("/a/b/c/acat", true|false);
+        tests.put("/a/b/c/d/acat", true|false);
+        tests.put("/a/b/c/d/cat/e", true|false);
+        tests.put("/a/b/c/d/acat/e", true|false);
+        tests.put("/a/b/c/d/cata/e", true|false);
+        tests.put("/a/b/c/cat/s", true|false);
+        tests.put("/a/b/c/cats/d/e/f", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testWildcardOnRoot() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/", "*");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|false);
+        tests.put("/a", true|false);
+        tests.put("/b/", true|false);
+        tests.put("/c/d", true|false);
+        tests.put("/a/b/ce/", true|false);
+        tests.put("/a/b/ce/f/g/h", true|false);
+        tests.put("/a/b/ce/d/e/f", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testEmptyOnRoot() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/", "");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|false);
+        tests.put("/a", true|false);
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/cde", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testEmpty() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|false);
+        tests.put("/a", true|false);
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/cde", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testPath() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "d");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|false);
+        tests.put("/a", true|false);
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/cd", true|false);
+        tests.put("/a/b/cde", true|false);
+        tests.put("/a/b/cd/e", true|false);
+        tests.put("/a/b/cd/e/f", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testPath2() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "/d");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|false);
+        tests.put("/a", true|false);
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/cd", true|false);
+        tests.put("/a/b/cde", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/cd/e", true|false);
+        tests.put("/a/b/cd/e/f", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    @Test
+    public void testPath3() throws Exception {
+        RestrictionPattern globPattern = buildGlobPattern("/a/b/c", "/d/");
+
+        // EXERCISE: fill-in the expected result for the match (true or false) for the given set of paths:
+        Map<String, Boolean> tests = new LinkedHashMap<>();
+        tests.put("/", true|false);
+        tests.put("/a", true|false);
+        tests.put("/a/b/c", true|false);
+        tests.put("/a/b/c/d", true|false);
+        tests.put("/a/b/c/d/e", true|false);
+        tests.put("/a/b/c/d/e/f", true|false);
+        tests.put("/a/b/cd", true|false);
+        tests.put("/a/b/cd/e", true|false);
+        tests.put("/a/b/cd/e/f", true|false);
+        tests.put("/a/b/cde", true|false);
+
+        for (String testPath : tests.keySet()) {
+            assertMatch(globPattern, testPath, tests.get(testPath));
+        }
+    }
+
+    private RestrictionPattern buildGlobPattern(@NotNull String path, @NotNull String glob) throws Exception {
+        RestrictionProvider rp = getConfig(AuthorizationConfiguration.class).getRestrictionProvider();
+        Restriction restriction = rp.createRestriction(path, AccessControlConstants.REP_GLOB, getValueFactory(root).createValue(glob));
+
+        return rp.getPattern(path, ImmutableSet.of(restriction));
+    }
 
+    private static void assertMatch(RestrictionPattern pattern, String testPath, boolean expectedResult) {
+        assertEquals("Pattern : " + pattern + "; TestPath : " + testPath, expectedResult, pattern.matches(testPath));
+    }
 }
\ No newline at end of file