@@ -54,22 +54,8 @@ private static function buildToken(Configuration $config, array $tokenData): Tok
5454 $ builder = $ config ->builder ();
5555 // Validate and coerce required registered claims to the expected types
5656 $ audience = $ tokenData [SSOData \SharedClaimsInterface::CLAIM_AUDIENCE ] ?? '' ;
57- if (is_string ($ audience )) {
58- if ($ audience === '' ) {
59- throw new \InvalidArgumentException ('aud claim must be a non-empty string or array for token generation ' );
60- }
61- /** @var non-empty-list<non-empty-string> $audiences */
62- $ audiences = [$ audience ];
63- } elseif (is_array ($ audience ) && $ audience !== []) {
64- foreach ($ audience as $ aud ) {
65- if (!is_string ($ aud ) || $ aud === '' ) {
66- throw new \InvalidArgumentException ('aud claim array must contain only non-empty strings for token generation ' );
67- }
68- }
69- /** @var non-empty-list<non-empty-string> $audiences */
70- $ audiences = array_values ($ audience );
71- } else {
72- throw new \InvalidArgumentException ('aud claim must be a non-empty string or array for token generation ' );
57+ if (!is_string ($ audience ) || $ audience === '' ) {
58+ throw new \InvalidArgumentException ('aud claim must be a non-empty string for token generation ' );
7359 }
7460
7561 $ issuedAt = $ tokenData [SSOData \SharedClaimsInterface::CLAIM_ISSUED_AT ] ?? null ;
@@ -88,7 +74,7 @@ private static function buildToken(Configuration $config, array $tokenData): Tok
8874 }
8975
9076 $ token = $ builder
91- ->permittedFor (... $ audiences )
77+ ->permittedFor ($ audience )
9278 ->issuedAt ($ issuedAt )
9379 ->canOnlyBeUsedAfter ($ notBefore )
9480 ->expiresAt ($ expiresAt );
0 commit comments