Skip to content

Commit 64d7c7b

Browse files
committed
fix: ResourceServer::isOwn checking
Change-Id: I9ee576f0fa8fc705af6fd6176f27c784fdecc8b0
1 parent 0f2b58e commit 64d7c7b

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

app/Models/OAuth2/ResourceServer.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use App\Models\Utils\BaseEntity;
1515
use Doctrine\Common\Collections\ArrayCollection;
1616
use Doctrine\ORM\Mapping AS ORM;
17+
use Illuminate\Support\Facades\Log;
18+
1719
/**
1820
* @package Models\OAuth2
1921
*/
@@ -63,9 +65,22 @@ class ResourceServer extends BaseEntity
6365
* @return bool
6466
*/
6567
public function isOwn($ip)
66-
{
67-
$ips = explode(',', $this->ips);
68-
return in_array($ip, $ips);
68+
{ $provided_ips = array_map('trim', explode(',', $ip));
69+
$own_ips = array_map('trim', explode(',', $this->ips));
70+
Log::debug
71+
(
72+
sprintf
73+
(
74+
"ResourceServer::isOwn resource server %s checking if %s is in %s",
75+
$this->id,
76+
$ip,
77+
$this->ips
78+
)
79+
);
80+
foreach ($provided_ips as $provided_ip){
81+
if(in_array($provided_ip, $own_ips)) return true;
82+
}
83+
return false;
6984
}
7085

7186
/**

0 commit comments

Comments
 (0)