From fcdfa22a63062f2d73a88ddab5208031c91cb91e Mon Sep 17 00:00:00 2001 From: Glenn Eggleton Date: Mon, 21 Mar 2016 13:03:35 -0400 Subject: [PATCH] Updated Readme --- README.md | 16 ++++++++++++++++ tests/AclRepositoryTest.php | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/README.md b/README.md index edf3bc4..b0b5d88 100644 --- a/README.md +++ b/README.md @@ -122,3 +122,19 @@ $app->add(function (Request $request, Response $res, $next) { } }); ``` + + +## White listing +You may add a URI path for white listing. The whitelisting is based upon `strpos()` so you may use a URI fragment to whitelist a whole class of URIs. +With this it is possible to whitelist URIs by accident. + +Example: +```php + +$acl = new Acl(); +$acl->addWhitelistItem('/api'); +``` + +In this example any URI with `/api` will be whitelisted. +- `/api/*` +- `/myexample/api/*` diff --git a/tests/AclRepositoryTest.php b/tests/AclRepositoryTest.php index 09ae25a..dbee13b 100644 --- a/tests/AclRepositoryTest.php +++ b/tests/AclRepositoryTest.php @@ -180,5 +180,15 @@ public function testAclRepoUser2_yes() { $this->assertEquals(200, $output->getStatusCode()); } + public function testAclRepoGuest_Whitelist() { + $reqRoot = $this->mockRequest('/yes'); + $res = $this->mockResponse(401); + + $acl = $this->user2; + $acl->addWhiteListUri('/yes'); + $output = $acl($reqRoot, $res, $this->getClosure()); + + $this->assertEquals(200, $output->getStatusCode()); + } }