docs(allow.multi-device): 添加日志

This commit is contained in:
李东云
2022-08-18 09:49:35 +08:00
parent fc3d06c689
commit 0300311b74

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Singularity\HyperfSaml\Services\Sp;
use Exception;
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\HttpMessage\Cookie\Cookie;
use Hyperf\HttpMessage\Stream\SwooleStream;
use Hyperf\HttpServer\Contract\RequestInterface;
@@ -46,6 +47,7 @@ class Assertion
private ResponseInterface $response,
private AuthenticationInterface $authentication,
private Redis $redis,
private StdoutLoggerInterface $stdoutLogger
) {
}
@@ -106,11 +108,16 @@ class Assertion
{
// 记录映射
$key = "{$redis_prefix}user:token_map:{$user['uid']}";
$this->stdoutLogger->info('allow multi device online: ' . $allow_multi_online);
if (!$allow_multi_online) {
// 顶掉之前已经登录的用户
$this->redis->del($key);
$this->stdoutLogger->info('删除现有记录');
$this->stdoutLogger->info($this->redis->type($key));
}
$this->redis->hSet($key, $user['originToken'], $token);
$this->stdoutLogger->info('更新后的现有记录');
$this->stdoutLogger->info($this->redis->type($key));
}
$url = config('saml.client.landing_host');