fix: 修复session鉴权的命名空间依赖

This commit is contained in:
李东云
2023-03-13 18:18:37 +08:00
parent ed644584b2
commit f59270006b

View File

@@ -18,11 +18,10 @@ use Hyperf\HttpMessage\Cookie\Cookie;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\Redis\Redis;
use Hyperf\Server\Exception\InvalidArgumentException;
use Singularity\HDK\Account\Services\Auth\AuthenticationInterface;
use Singularity\HDK\Auth\Resource\User;
use Singularity\HDK\Utils\Constants\CommonErrorCode;
use Singularity\HDK\Utils\Exceptions\Unauthorized;
use Singularity\HDK\Utils\Exceptions\ValidateException;
use Singularity\HDK\Core\Constants\CommonErrorCode;
use Singularity\HDK\Core\Exceptions\Unauthorized;
use Singularity\HDK\Core\Exceptions\ValidateException;
class SessionAuthentication implements AuthenticationInterface
{
@@ -56,9 +55,9 @@ class SessionAuthentication implements AuthenticationInterface
*/
public function verified(?string $token = null): User
{
if (!$this->session->isValidId($token ?? '')) {
throw new ValidateException(CommonErrorCode::AUTH_SESSION_ERROR, 'token', $token);
}
// if (!$this->session->isValidId($token ?? '')) {
// throw new ValidateException(CommonErrorCode::AUTH_SESSION_ERROR, 'token', $token);
// }
$user = $this->session->get('userInfo');
if (empty($user)) {