public function testGenerationOfTheSigninInput()
 {
     $payload = array('a' => 'b');
     $header = array('a' => 'b');
     $jwt = new JWT($payload, $header);
     $encoder = new Base64UrlSafeEncoder();
     $this->assertEquals(sprintf("%s.%s", $encoder->encode(json_encode($payload)), $encoder->encode(json_encode($header))), $jwt->generateSigninInput());
 }
Exemple #2
0
 public function testGenerationOfTheSigninInputCanHandleSlashes()
 {
     $encoder = new Base64UrlSafeEncoder();
     $json_string = '{"a":"/b/"}';
     $encoded_json_string = $encoder->encode($json_string);
     $jwt = new JWT(json_decode($json_string, true), json_decode($json_string, true));
     $this->assertEquals(sprintf('%s.%s', $encoded_json_string, $encoded_json_string), $jwt->generateSigninInput());
 }