Skip to content

Commit

Permalink
Update JWTMiddleware.php
Browse files Browse the repository at this point in the history
bug fixed... now working smoothly :)
  • Loading branch information
AnandPilania authored Aug 14, 2019
1 parent 8d44fbf commit 48846a7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions JWTMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected function validate($handler, $args, $alias) {
$this->app->set('JWT.token', $jwtToken);
$this->app->set('JWT.user', $model->cast());

die($model->cast());
return true;
}

public function generate($sub) {
Expand All @@ -138,22 +138,22 @@ public function generate($sub) {
}

$payload = [
'iss' => $this->app->get('ISSUER'),
'sub' => $sub,
'iat' => $this->app->get('IAT'),
'exp' => time() + $this->app->get('EXP')
];
return JWT::encode($payload, $this->app->get('JWT.SECRET'));
'iss' => $this->app->get('JWT.ISSUER'),
'sub' => $sub,
'iat' => $this->app->get('JWT.IAT'),
'exp' => time() + $this->app->get('JWT.EXP')
];
return JWT::encode($payload, $this->app->get('JWT.SECRET'));
}

private function startsWith($haystack, $needles) {
foreach ((array) $needles as $needle) {
if ($needle !== '' && substr($haystack, 0, strlen($needle)) === (string) $needle) {
return true;
}
}
return false;
}
foreach ((array) $needles as $needle) {
if ($needle !== '' && substr($haystack, 0, strlen($needle)) === (string) $needle) {
return true;
}
}

return false;
}
}

0 comments on commit 48846a7

Please sign in to comment.