Skip to content

Commit 241c8ab

Browse files
authored
fix minor bug in logic (#1833)
* fix minor bug in logic * fix logic
1 parent 77008da commit 241c8ab

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## NOT RELEASED
44

5+
## 1.24.1
6+
7+
### Fixed
8+
9+
- Better detection and error messages for when SSO is used but required packages are not installed.
10+
511
## 1.24.0
612

713
### Added

src/Credentials/IniFileProvider.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use AsyncAws\Core\Exception\RuntimeException;
99
use AsyncAws\Core\Sts\StsClient;
1010
use AsyncAws\Sso\SsoClient;
11+
use AsyncAws\SsoOidc\SsoOidcClient;
1112
use Psr\Log\LoggerInterface;
1213
use Psr\Log\NullLogger;
1314
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -94,8 +95,8 @@ private function getCredentialsFromProfile(array $profilesData, string $profile,
9495
}
9596

9697
if (isset($profileData[IniFileLoader::KEY_SSO_SESSION])) {
97-
if (!class_exists(SsoClient::class)) {
98-
$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]);
98+
if (!class_exists(SsoClient::class) || !class_exists(SsoOidcClient::class)) {
99+
$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]);
99100

100101
return null;
101102
}
@@ -104,7 +105,7 @@ private function getCredentialsFromProfile(array $profilesData, string $profile,
104105
}
105106

106107
if (isset($profileData[IniFileLoader::KEY_SSO_START_URL])) {
107-
if (class_exists(SsoClient::class)) {
108+
if (!class_exists(SsoClient::class)) {
108109
$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]);
109110

110111
return null;

0 commit comments

Comments
 (0)