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 2caab8ee3..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; } @@ -104,7 +105,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;