diff --git a/src/Services/Sp/Assertion.php b/src/Services/Sp/Assertion.php index c99845b..e548a83 100644 --- a/src/Services/Sp/Assertion.php +++ b/src/Services/Sp/Assertion.php @@ -45,12 +45,12 @@ use function Hyperf\Config\config; class Assertion { public function __construct( - private Base $base, - private RequestInterface $request, - private ResponseInterface $response, - private AuthenticationInterface $authentication, - private Redis $redis, - private StdoutLoggerInterface $stdoutLogger + private readonly Base $base, + private readonly RequestInterface $request, + private readonly ResponseInterface $response, + private readonly AuthenticationInterface $authentication, + private readonly Redis $redis, + private readonly StdoutLoggerInterface $stdoutLogger ) { } diff --git a/src/Services/Sp/Sso.php b/src/Services/Sp/Sso.php index f22a446..c50ad66 100644 --- a/src/Services/Sp/Sso.php +++ b/src/Services/Sp/Sso.php @@ -12,16 +12,16 @@ declare(strict_types=1); namespace Singularity\HyperfSaml\Services\Sp; use Hyperf\Codec\Json; -use Singularity\HDK\Core\Constants\CommonErrorCode; -use Singularity\HDK\Core\Exceptions\Forbidden; -use Swoole\Exception; use Hyperf\Contract\StdoutLoggerInterface; -use Hyperf\Di\Annotation\Inject; use Hyperf\HttpServer\Contract\RequestInterface; use Hyperf\HttpServer\Contract\ResponseInterface; use Hyperf\Redis\Redis; use Psr\Http\Message\ResponseInterface as PsrResponseInterface; +use RedisException; +use Singularity\HDK\Core\Constants\CommonErrorCode; +use Singularity\HDK\Core\Exceptions\Forbidden; use Singularity\HyperfSaml\Services\Base; +use Swoole\Exception; use Teapot\StatusCode\RFC\RFC7231; use function Hyperf\Config\config; @@ -42,11 +42,11 @@ class Sso private string $issuer; public function __construct( - private Base $base, - private RequestInterface $request, - private ResponseInterface $response, - private Redis $redis, - private StdoutLoggerInterface $stdoutLogger + private readonly Base $base, + private readonly RequestInterface $request, + private readonly ResponseInterface $response, + private readonly Redis $redis, + private readonly StdoutLoggerInterface $stdoutLogger ) { $this->idpId = config('saml.server.idp_id'); $this->idpAssertionUrl = config('saml.server.idp_assertion_url'); @@ -58,7 +58,7 @@ class Sso /** * 自动重定向获取用户登录状态 * - * @return \Psr\Http\Message\ResponseInterface + * @return PsrResponseInterface */ public function redirectSsoStatus(): PsrResponseInterface { @@ -73,7 +73,7 @@ class Sso /** * 自动重定向到单点登录 * - * @return \Psr\Http\Message\ResponseInterface + * @return PsrResponseInterface */ public function redirectSso(): PsrResponseInterface { @@ -99,8 +99,8 @@ class Sso * @param $token * * @return void - * @throws \Singularity\HDK\Utils\Exceptions\Forbidden - * @throws \RedisException + * @throws Forbidden + * @throws RedisException * @throws \Exception */ public function checkMultiDeviceOnline($uid, $token): void @@ -112,7 +112,7 @@ class Sso return; } $redis_prefix = config('common.redis.prefix'); - $key = "{$redis_prefix}user:token_map:{$uid}"; + $key = "{$redis_prefix}user:token_map:$uid"; $type = $this->redis->type($key); try {