Exemple #1
0
 /**
  * Test the encryption and decryption of the token data
  */
 public function testEncryptDecryptToken()
 {
     $encryptKey = 'test1234';
     $header = new Header('test');
     $jwt = new Jwt($header);
     $jwt->issuer('http://example.org')->audience('http://example.com')->issuedAt(1356999524)->notBefore(1357000000)->expireTime(time() + 3600)->jwtId('id123456')->type('https://example.com/register')->custom('test', 'claim1');
     $result = $jwt->encrypt('AES-256-CBC', '1234567812345678', $encryptKey);
     $result = $jwt->decrypt($result, 'AES-256-CBC', '1234567812345678', $encryptKey);
     $this->assertEquals($result->aud, 'http://example.com');
 }