Skip to content

Commit

Permalink
optimal(jwt): login_type设置默认值(#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
luckydog-sunny authored Aug 21, 2024
1 parent a79bae6 commit 18f22e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/System/Listener/LoginListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function process(object $event): void
$config = $jwt->getSceneConfig($scene);
$key = match ($config['login_type']) {
'sso' => sprintf('%sToken:%s', config('cache.default.prefix'), $event->userinfo['id']),
'mpop' => sprintf('%sToken:%s:%s', config('cache.default.prefix'), $event->userinfo['id'], $parserData['jti']),
default => sprintf('%sToken:%s:%s', config('cache.default.prefix'), $event->userinfo['id'], $parserData['jti']),
};
$redis->del($key);
$redis->set($key, $event->token, config('jwt.ttl'));
Expand Down
2 changes: 1 addition & 1 deletion config/autoload/jwt.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
],
'application3' => [
'secret' => 'application3', // 非对称加密使用字符串,请使用自己加密的字符串
'login_type' => 'mppo', // 登录方式,sso为单点登录,mpop为多点登录
'login_type' => 'mpop', // 登录方式,sso为单点登录,mpop为多点登录
'ttl' => 7200, // token过期时间,单位为秒
'blacklist_cache_ttl' => env('JWT_TTL', 7200), // 黑名单缓存token时间,注意:该时间一定要设置比token过期时间要大一点,默认为100秒,最好设置跟过期时间一样
],
Expand Down

0 comments on commit 18f22e0

Please sign in to comment.