mirror of
https://gitee.com/ctexthuang/hyperf-micro-svc.git
synced 2026-02-08 10:20:16 +08:00
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* This service file is part of item.
|
|
*
|
|
* @author ctexthuang
|
|
* @contact ctexthuang@qq.com
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Service\Admin\AdminUser;
|
|
|
|
use App\Lib\Jwt\RequestScopedTokenTrait;
|
|
use App\Service\Admin\BaseAdminService;
|
|
use App\Service\BaseTokenService;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use Lcobucci\JWT\Token\RegisteredClaims;
|
|
|
|
class UserService extends BaseAdminService
|
|
{
|
|
use RequestScopedTokenTrait;
|
|
|
|
/**
|
|
* @var BaseTokenService
|
|
*/
|
|
#[Inject]
|
|
protected BaseTokenService $tokenService;
|
|
|
|
public function handle(): array
|
|
{
|
|
var_dump($this->getToken()->claims()->all());
|
|
var_dump($this->getToken()->claims()->get(RegisteredClaims::ID));
|
|
var_dump($this->getToken()->claims()->get(RegisteredClaims::AUDIENCE));
|
|
|
|
return $this->adminReturn->success();
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function logout(): array
|
|
{
|
|
$this->tokenService->setJwt('admin')->getJwt()->addBlackList($this->getToken());
|
|
|
|
return $this->adminReturn->success();
|
|
}
|
|
} |