예제 #1
0
 /**
  * Encode the JSON web token
  */
 protected function _encode()
 {
     $this->_header['typ'] = 'JWT';
     $this->_header['alg'] = $this->_algorithm;
     $segments = array('header' => $this->urlSafeB64Encode(Steelcode_Json_Helper::encode($this->_header)), 'payload' => $this->urlSafeB64Encode(Steelcode_Json_Helper::encode($this->_payload)), 'signature' => '');
     $this->_signature = $this->_sign("{$segments['header']}.{$segments['payload']}");
     $segments['signature'] = $this->urlSafeB64Encode($this->_signature);
     return Steelcode_Array_Helper::implode('.', $segments);
 }
예제 #2
0
 /**
  * Flush the output
  */
 public function flushOutput()
 {
     foreach ($this->_levelFlags as $level => $state) {
         if ($state === false || empty($this->_topLevels[$level])) {
             unset($this->_topLevels[$level]);
         }
     }
     echo Steelcode_Json_Helper::encode($this->_topLevels);
 }