diff --git a/server/SHServ/Integrations/GAuth/AuthControllerTrait.php b/server/SHServ/Integrations/GAuth/AuthControllerTrait.php index 1e0542a..6a42754 100644 --- a/server/SHServ/Integrations/GAuth/AuthControllerTrait.php +++ b/server/SHServ/Integrations/GAuth/AuthControllerTrait.php @@ -108,18 +108,10 @@ } } - // IP / User-Agent binding check - $clientIp = $this->getClientIp(); - $clientUa = $_SERVER['HTTP_USER_AGENT'] ?? null; - $hasStoredIp = !empty($row['ip_address']); - $hasStoredUa = !empty($row['user_agent']); - - if (($hasStoredIp && $row['ip_address'] !== $clientIp) || - ($hasStoredUa && $row['user_agent'] !== $clientUa)) { - $this->authError = 'session_suspicious'; - return null; - } - + // NOTE: IP / User-Agent binding disabled because reverse-proxy setups + // (nginx → php-fpm via unix socket) report REMOTE_ADDR as 127.0.0.1 + // for all requests, making binding unreliable. The fields are still + // stored in shserv_sessions for audit purposes. return $this->load_user_by_id((int) $row['user_id']); } diff --git a/server/SHServ/Routes.php b/server/SHServ/Routes.php index 83577d1..2f41673 100644 --- a/server/SHServ/Routes.php +++ b/server/SHServ/Routes.php @@ -72,6 +72,11 @@ $this -> router -> uri("/auth/callback", "{$this -> cn}\\AuthController@callback"); $this -> router -> uri("/auth/me", "{$this -> cn}\\AuthController@me"); + // Auth (API v1 aliases for unified client routing) + $this -> router -> uri("/api/v1/auth/login", "{$this -> cn}\\AuthController@login"); + $this -> router -> uri("/api/v1/auth/callback", "{$this -> cn}\\AuthController@callback"); + $this -> router -> uri("/api/v1/auth/me", "{$this -> cn}\\AuthController@me"); + // Webhooks $this -> router -> uri("/webhooks/gnexus-auth", "{$this -> cn}\\WebhookController@gnexus_auth"); } @@ -105,6 +110,18 @@ "/auth/refresh" ); + // Auth (API v1 aliases) + $this -> router -> post( + [], + "{$this -> cn}\\AuthController@logout", + "/api/v1/auth/logout" + ); + $this -> router -> post( + [], + "{$this -> cn}\\AuthController@refresh", + "/api/v1/auth/refresh" + ); + } /**