Beispiel #1
0
 /**
  *
  */
 public function testNoneSignAndVerifyComplete()
 {
     $jwt = new JWT();
     $jwt->setProtectedHeader(['alg' => 'none']);
     $jwt->setPayload('Je suis Charlie');
     $jwk = new JWK(['kty' => 'none']);
     $instruction1 = new SignatureInstruction();
     $instruction1->setKey($jwk)->setProtectedHeader(['alg' => 'none']);
     $signer = $this->getSigner();
     $loader = $this->getLoader();
     $signed = $signer->sign($jwt, [$instruction1]);
     $this->assertTrue(is_string($signed));
     $result = $loader->load($signed);
     $this->assertInstanceOf('Jose\\JWSInterface', $result);
     $this->assertEquals('Je suis Charlie', $result->getPayload());
     $this->assertEquals('none', $result->getAlgorithm());
 }