mirror of
http://124.126.16.154:8888/singularity/hyperf-saml.git
synced 2026-01-15 03:25:05 +08:00
docs(allow.multi-device): 添加日志
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user