@@ -92,6 +92,39 @@ public function testAdditionalClaims(): void
9292 $ this ->assertEquals (900 , $ payload ['nbf ' ]);
9393 }
9494
95+ /**
96+ * @link https://github.com/Vonage/vonage-php-sdk-core/issues/276
97+ */
98+ public function testExampleConversationJWTWorks ()
99+ {
100+ $ credentials = new Keypair ($ this ->key , $ this ->application );
101+ $ claims = [
102+ 'exp ' => strtotime (date ('Y-m-d ' , strtotime ('+24 Hours ' ))),
103+ 'sub ' => 'apg-cs ' ,
104+ 'acl ' => [
105+ 'paths ' => [
106+ '/*/users/** ' => (object ) [],
107+ '/*/conversations/** ' => (object ) [],
108+ '/*/sessions/** ' => (object ) [],
109+ '/*/devices/** ' => (object ) [],
110+ '/*/image/** ' => (object ) [],
111+ '/*/media/** ' => (object ) [],
112+ '/*/applications/** ' => (object ) [],
113+ '/*/push/** ' => (object ) [],
114+ '/*/knocking/** ' => (object ) [],
115+ '/*/legs/** ' => (object ) [],
116+ ]
117+ ],
118+ ];
119+
120+ $ jwt = $ credentials ->generateJwt ($ claims );
121+ [, $ payload ] = $ this ->decodeJWT ($ jwt ->toString ());
122+
123+ $ this ->assertArrayHasKey ('exp ' , $ payload );
124+ $ this ->assertEquals ($ claims ['exp ' ], $ payload ['exp ' ]);
125+ $ this ->assertEquals ($ claims ['sub ' ], $ payload ['sub ' ]);
126+ }
127+
95128 /**
96129 * @param $jwt
97130 */
0 commit comments