From 8d6c7cf060a8ef51cc55c752933214d6bd8f32dd Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 15 Jan 2025 11:28:37 +0100 Subject: [PATCH 1/2] fix minor bug in logic --- src/Core/src/Credentials/IniFileProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/src/Credentials/IniFileProvider.php b/src/Core/src/Credentials/IniFileProvider.php index 2caab8ee3..6e16bf7dc 100644 --- a/src/Core/src/Credentials/IniFileProvider.php +++ b/src/Core/src/Credentials/IniFileProvider.php @@ -104,7 +104,7 @@ private function getCredentialsFromProfile(array $profilesData, string $profile, } if (isset($profileData[IniFileLoader::KEY_SSO_START_URL])) { - if (class_exists(SsoClient::class)) { + if (!class_exists(SsoClient::class)) { $this->logger->warning('The profile "{profile}" contains SSO (legacy) config but the "async-aws/sso" package is not installed. Try running "composer require async-aws/sso".', ['profile' => $profile]); return null; From 402f01aec7633e21d594231c7ddfe55cda951cb4 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 15 Jan 2025 13:10:34 +0100 Subject: [PATCH 2/2] fix logic --- src/Core/CHANGELOG.md | 6 ++++++ src/Core/src/Credentials/IniFileProvider.php | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Core/CHANGELOG.md b/src/Core/CHANGELOG.md index a094064f5..f1537ed4e 100644 --- a/src/Core/CHANGELOG.md +++ b/src/Core/CHANGELOG.md @@ -2,6 +2,12 @@ ## NOT RELEASED +## 1.24.1 + +### Fixed + +- Better detection and error messages for when SSO is used but required packages are not installed. + ## 1.24.0 ### Added diff --git a/src/Core/src/Credentials/IniFileProvider.php b/src/Core/src/Credentials/IniFileProvider.php index 6e16bf7dc..5d13512ed 100644 --- a/src/Core/src/Credentials/IniFileProvider.php +++ b/src/Core/src/Credentials/IniFileProvider.php @@ -8,6 +8,7 @@ use AsyncAws\Core\Exception\RuntimeException; use AsyncAws\Core\Sts\StsClient; use AsyncAws\Sso\SsoClient; +use AsyncAws\SsoOidc\SsoOidcClient; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Symfony\Contracts\HttpClient\HttpClientInterface; @@ -94,8 +95,8 @@ private function getCredentialsFromProfile(array $profilesData, string $profile, } if (isset($profileData[IniFileLoader::KEY_SSO_SESSION])) { - if (!class_exists(SsoClient::class)) { - $this->logger->warning('The profile "{profile}" contains SSO session config but the "async-aws/sso" package is not installed. Try running "composer require async-aws/sso".', ['profile' => $profile]); + if (!class_exists(SsoClient::class) || !class_exists(SsoOidcClient::class)) { + $this->logger->warning('The profile "{profile}" contains SSO session config but the required packages ("async-aws/sso" and "async-aws/sso-oidc") are not installed. Try running "composer require async-aws/sso async-aws/sso-oidc".', ['profile' => $profile]); return null; }