fix(authn): 修复不再被支持的 swoole 变量

This commit is contained in:
李东云
2025-04-10 16:52:37 +08:00
parent 61dbf7f537
commit aa1833d37c
2 changed files with 800 additions and 881 deletions

1671
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
<?php
/**
* Sso.php@HyperfSaml
*
@@ -42,8 +43,7 @@ class Sso
private readonly ResponseInterface $response,
private readonly StdoutLoggerInterface $stdoutLogger,
private readonly ?Redis $redis,
) {
}
) {}
/**
* 自动重定向获取用户登录状态
@@ -133,7 +133,7 @@ class Sso
try {
$this->stdoutLogger->info('user_token redis type: ' . $type);
switch ($type) {
case SWOOLE_REDIS_TYPE_STRING:
case 1:
// 旧的值
// 理论上只有刚切换的时候才会有此情况
$last_token = $this->redis->get($key);
@@ -141,7 +141,7 @@ class Sso
throw new Exception(code: CommonErrorCode::AUTH_SESSION_CREATED_AT_ERROR);
}
break;
case SWOOLE_REDIS_TYPE_HASH:
case 5:
$origin_token = $this->redis->hKeys($key);
$this->stdoutLogger->info('user_token redis keys: ' . Json::encode($origin_token));
$origin_token = array_pop($origin_token);
@@ -153,7 +153,7 @@ class Sso
throw new Exception(code: CommonErrorCode::AUTH_SESSION_CREATED_AT_ERROR);
}
break;
case SWOOLE_REDIS_TYPE_NOT_FOUND:
case 0:
break;
default:
throw new \Exception(code: CommonErrorCode::SERVER_ERROR);