Skip to content

Commit 16f7db9

Browse files
committed
fixed #57 #58
1 parent 6a44c0b commit 16f7db9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Config/firewall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
'enabled' => env('FIREWALL_ENABLED', true),
66

7-
'whitelist' => [env('FIREWALL_WHITELIST', '')],
7+
'whitelist' => explode(',', env('FIREWALL_WHITELIST', '')),
88

99
'models' => [
1010
'user' => '\App\Models\User',

tests/Feature/WhitelistTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Akaunting\Firewall\Tests\Feature;
44

55
use Akaunting\Firewall\Middleware\Whitelist;
6-
use Akaunting\Firewall\Models\Ip as Model;
76
use Akaunting\Firewall\Tests\TestCase;
87

98
class WhitelistTest extends TestCase
@@ -15,6 +14,13 @@ public function testShouldAllow()
1514
$this->assertEquals('next', (new Whitelist())->handle($this->app->request, $this->getNextClosure()));
1615
}
1716

17+
public function testShouldAllowMultiple()
18+
{
19+
config(['firewall.whitelist' => ['127.0.0.0/24', '127.0.0.1']]);
20+
21+
$this->assertEquals('next', (new Whitelist())->handle($this->app->request, $this->getNextClosure()));
22+
}
23+
1824
public function testShouldBlock()
1925
{
2026
$this->assertEquals('403', (new Whitelist())->handle($this->app->request, $this->getNextClosure())->getStatusCode());

0 commit comments

Comments
 (0)