Exemple #1
0
 private function setToken(JWT $jwt) : self
 {
     $claims = $jwt->getClaims();
     $this->uid = $claims['uid'];
     // Override any previously-set user to re-perform validation
     $this->user = null;
     // Restore timestamps
     $dt = function ($idx) use($claims) {
         return isset($claims[$idx]) ? new DateTime($claims[$idx]) : null;
     };
     $this->ifct = $dt('ifct');
     $this->ifet = $dt('ifet');
     $this->kfct = $dt('kfct');
     $this->kfet = $dt('kfet');
     $this->pfct = $dt('pfct');
     $this->pfet = $dt('pfet');
     $this->hst = $dt('hst');
     return $this;
 }
Exemple #2
0
 /**
  * @covers ::__construct
  * @covers ::getClaims
  */
 public function testNewTokenAllowsAccessToClaims()
 {
     $data = ['data' => true];
     $tok = new JWT($data);
     $this->assertEquals($data, $tok->getClaims(), 'getClaims did not return the provided data');
 }