Exemplo n.º 1
0
 protected function createToken($userId, array $scopes)
 {
     // @TODO this is the consumer app. Probably we need a better way to
     // define this id
     $appId = 2;
     $token = $this->app->generateAccessToken($appId, $userId, $scopes, isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1', new DateInterval($this->psxConfig->get('fusio_expire_consumer')));
     $user = $this->user->get($userId);
     $payload = ['sub' => $token->getAccessToken(), 'iat' => time(), 'exp' => $token->getExpiresIn(), 'name' => $user['name']];
     return JWT::encode($payload, $this->psxConfig->get('fusio_project_key'));
 }
Exemplo n.º 2
0
 /**
  * Returns the GET response
  *
  * @return array|\PSX\Record\RecordInterface
  */
 protected function doGet()
 {
     return $this->userService->get($this->userId);
 }
Exemplo n.º 3
0
 public function onGet()
 {
     $this->setBody($this->userService->get($this->userId));
 }