Skip to content

Commit ebaaa13

Browse files
committed
bug #999 Unify audience claim (aerrasti)
This PR was merged into the 2.x branch. Discussion ---------- Unify audience claim The 'aud' part of the payload is being converted to array, thats why we need to use UnifyAudience claim formatter to create lcobucci token. Before the change: ```json { "iss": "iss", "aud": [ "audience" ], "sub": "sub", } ``` After the change ```json { "iss": "iss", "aud": "audience", "sub": "sub", } ``` Check out the `default` method: https://github.com/lcobucci/jwt/blob/4.2.x/src/Encoding/ChainedFormatter.php :) Commits ------- 666b1ce Unify audience claim
2 parents c06387e + 666b1ce commit ebaaa13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Services/JWSProvider/LcobucciJWSProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use Lcobucci\Clock\SystemClock;
66
use Lcobucci\JWT\Builder;
7+
use Lcobucci\JWT\Encoding\ChainedFormatter;
78
use Lcobucci\JWT\Encoding\JoseEncoder;
8-
use Lcobucci\JWT\Encoding\MicrosecondBasedDateConversion;
99
use Lcobucci\JWT\Parser;
1010
use Lcobucci\JWT\Signer;
1111
use Lcobucci\JWT\Signer\Hmac;
@@ -87,7 +87,7 @@ public function __construct(KeyLoaderInterface $keyLoader, string $cryptoEngine,
8787
public function create(array $payload, array $header = [])
8888
{
8989
if (class_exists(JWTBuilder::class)) {
90-
$jws = new JWTBuilder(new JoseEncoder(), new MicrosecondBasedDateConversion());
90+
$jws = new JWTBuilder(new JoseEncoder(), ChainedFormatter::default());
9191
} else {
9292
$jws = new Builder();
9393
}

0 commit comments

Comments
 (0)