From eaccaacf96c6ba3bfb550a94d50d018c5d70e953 Mon Sep 17 00:00:00 2001 From: netkas Date: Thu, 27 Mar 2025 12:52:46 -0400 Subject: [PATCH] Normalize domain input to lowercase in getExternalSession method and add authentication check --- src/Socialbox/Socialbox.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Socialbox/Socialbox.php b/src/Socialbox/Socialbox.php index f91eed9..3afb2f2 100644 --- a/src/Socialbox/Socialbox.php +++ b/src/Socialbox/Socialbox.php @@ -734,6 +734,8 @@ */ public static function getExternalSession(string $domain): SocialClient { + $domain = strtolower($domain); + if(ExternalSessionManager::sessionExists($domain)) { return new SocialClient(self::getServerAddress(), $domain, ExternalSessionManager::getSession($domain)); @@ -749,6 +751,11 @@ throw new ResolutionException(sprintf('Failed to connect to remote server %s: %s', $domain, $e->getMessage()), $e->getCode(), $e); } + if(!$client->getSessionState()->isAuthenticated()) + { + throw new ResolutionException(sprintf('Failed to authenticate with remote server %s', $domain)); + } + ExternalSessionManager::addSession($client->exportSession()); return $client; }