Skip to content

Commit

Permalink
fix: Fix Auth token cache time (swoft-cloud/swoft-component#223)
Browse files Browse the repository at this point in the history
* composer update

* fix #419 token cache time is incorrect.

* update composer
  • Loading branch information
rlgy authored and swoft-bot committed Nov 2, 2018
1 parent c0f55c2 commit 477dbb4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/AuthManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function login(string $accountTypeName, array $data): AuthSession
if ($this->cacheEnable === true) {
try {
$this->getCacheClient()
->set($this->getCacheKey($session->getIdentity(), $session->getExtendedData()), $session->getToken(), $session->getExpirationTime());
->set($this->getCacheKey($session->getIdentity(), $session->getExtendedData()), $session->getToken(), $this->getSessionDuration());
} catch (InvalidArgumentException $e) {
$err = sprintf('%s Invalid Argument : %s', $session->getIdentity(), $e->getMessage());
throw new AuthException(ErrorCode::POST_DATA_NOT_PROVIDED, $err);
Expand Down Expand Up @@ -135,7 +135,6 @@ public function generateSession(string $accountTypeName, string $identity, array
->setCreateTime($startTime)
->setIdentity($identity)
->setAccountTypeName($accountTypeName);
$session->setExtendedData($data);
$token = $this->getTokenParser()->getToken($session);
$session->setToken($token);
return $session;
Expand Down

0 comments on commit 477dbb4

Please sign in to comment.