Skip to content

Commit 53fced6

Browse files
committed
feat: add validate_resource_server_ip feature flag to config and check to validate
Signed-off-by: romanetar <roman_ag@hotmail.com>
1 parent 9ee4d37 commit 53fced6

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ AUTH_PASSWORD_SHAPE_PATTERN="^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^
115115
AUTH_PASSWORD_SHAPE_WARNING="Password must include at least one uppercase letter, one lowercase letter, one number, and one special character."
116116

117117

118+
OAUTH2_VALIDATE_RESOURCE_SERVER_IP=true
119+
118120
#Open Telemetry
119121
OTEL_SERVICE_ENABLED=true
120122
OTEL_SERVICE_NAME=idp-api

app/Models/OAuth2/ResourceServer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ class ResourceServer extends BaseEntity
6565
* @return bool
6666
*/
6767
public function isOwn($ip)
68-
{ $provided_ips = array_map('trim', explode(',', $ip));
68+
{
69+
if (!config('oauth2.validate_resource_server_ip', true)) return true;
70+
71+
$provided_ips = array_map('trim', explode(',', $ip));
6972
$own_ips = array_map('trim', explode(',', $this->ips));
7073
Log::debug
7174
(

config/oauth2.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Validate Resource Server IP Address
8+
|--------------------------------------------------------------------------
9+
|
10+
| When enabled, validates that the resource server IP address matches
11+
| the request IP and the access token audience.
12+
|
13+
*/
14+
'validate_resource_server_ip' => env('OAUTH2_VALIDATE_RESOURCE_SERVER_IP', true),
15+
];

0 commit comments

Comments
 (0)