public function isUriAllowed($uri) { if (!filter_var($uri, FILTER_VALIDATE_URL)) { return false; } $parts = @parse_url($uri); if ($parts == false) { return false; } if ($parts['scheme'] !== 'https' && ServerConfigurationService::getConfigValue("SSL.Enable")) { return false; } //normalize uri $normalized_uri = $parts['scheme'] . '://' . strtolower($parts['host']); if (isset($parts['path'])) { $normalized_uri .= strtolower($parts['path']); } // normalize url and remove trailing / $normalized_uri = rtrim($normalized_uri, '/'); $client_authorized_uri = ClientAuthorizedUri::where('client_id', '=', $this->id)->where('uri', '=', $normalized_uri)->first(); return !is_null($client_authorized_uri); }