/** * @link http://bshaffer.github.io/oauth2-server-php-docs/grant-types/jwt-bearer/ */ function generateJwtAssertion($privateKey, $iss, $sub, $aud, $exp = null, $nbf = null, $jti = null) { if (!$exp) { $exp = time() + 1000; } $params = array('iss' => $iss, 'sub' => $sub, 'aud' => $aud, 'exp' => $exp, 'iat' => time()); if ($nbf) { $params['nbf'] = $nbf; } if ($jti) { $params['jti'] = $jti; } $jwtUtil = new JwtUtil(); return $jwtUtil->encode($params, $privateKey, 'RS256'); }
private function isIgnoredWidget($arr, $val) { if (JwtUtil::endsWith($val, '__LAYOUT__')) { $val = str_replace("__LAYOUT__", "", $val); } foreach ($arr as $value) { if ($value == $val) { return true; } } return false; }
public function register() { $res = new stdClass(); $res->success = FALSE; $data = $this->post(); $this->load->model('sp_model'); unset($data->confirmPassword); $data->joinDate = date("Y-m-d"); $data->password = Password::create_hash($data->password); $res->id = $this->sp_model->create('jwt_user', $data); JwtUtil::log(json_encode($res)); $this->load->view('json', array('output' => $res)); }
public static function rename($pathx, $newName, $oldName) { $path = $pathx . $oldName; if (!JwtUtil::folderExists($path)) { return; } if (JwtUtil::fileExists($path . "/" . $oldName . ".html")) { rename($path . "/" . $oldName . ".html", $path . "/" . $newName . ".html"); //unlink($path ."/". $oldName . ".html"); } if (JwtUtil::fileExists($path . "/" . $oldName . "Ctrl.js")) { rename($path . "/" . $oldName . "Ctrl.js", $path . "/" . $newName . "Ctrl.js"); //unlink($path ."/". $oldName . "Ctrl.js"); } if (JwtUtil::fileExists($path . "/" . $oldName . "Svc.js")) { rename($path . "/" . $oldName . "Svc.js", $path . "/" . $newName . "Svc.js"); //unlink($path ."/". $oldName . "Svc.js"); } if (JwtUtil::fileExists($path . "/" . $oldName . ".css")) { rename($path . "/" . $oldName . ".css", $path . "/" . $newName . ".css"); //unlink($path ."/". $oldName . ".css"); } rename($path, $pathx . $newName); }
public function getTemplate($name) { if (JwtUtil::endsWith($name, '__LAYOUT__')) { $name = str_replace("__LAYOUT__", "", $name); return JwtUtil::getContent($this->rootPath . "Scripts/Layouts/{$name}/{$name}.html"); } return JwtUtil::getContent($this->rootPath . "Scripts/Components/{$name}/{$name}.html"); }
private function getNavigationStateName($navigation) { $nameList = array(); $nameList[] = $navigation['NavigationName']; $layout = null; if (!JwtUtil::IsNullOrEmptyString($navigation['HasLayout'])) { $layout = $this->array_find($this->app->Layouts, 'LayoutName', $navigation['HasLayout']); if (isset($layout)) { $nameList[] = $layout['LayoutName']; while (!JwtUtil::IsNullOrEmptyString($layout['Extend'])) { $layout = $this->array_find($this->app->Layouts, 'LayoutName', $layout['Extend']); if (isset($layout)) { $nameList[] = $layout['LayoutName']; } } } } return implode(".", array_reverse($nameList)); }