Normalize domain input to lowercase in getExternalSession method and add authentication check
This commit is contained in:
parent
fb31c3cc6a
commit
eaccaacf96
1 changed files with 7 additions and 0 deletions
|
@ -734,6 +734,8 @@
|
||||||
*/
|
*/
|
||||||
public static function getExternalSession(string $domain): SocialClient
|
public static function getExternalSession(string $domain): SocialClient
|
||||||
{
|
{
|
||||||
|
$domain = strtolower($domain);
|
||||||
|
|
||||||
if(ExternalSessionManager::sessionExists($domain))
|
if(ExternalSessionManager::sessionExists($domain))
|
||||||
{
|
{
|
||||||
return new SocialClient(self::getServerAddress(), $domain, ExternalSessionManager::getSession($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);
|
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());
|
ExternalSessionManager::addSession($client->exportSession());
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue