jwtFactory->get('admin'); } /** * @param UnencryptedToken $token * @return void */ public function checkIssuer(UnencryptedToken $token): void { $audience = $token->claims()->get(RegisteredClaims::ISSUER); if ($audience !== env('APP_NAME') .'_admin') throw new ErrException('token错误',ResultCode::JWT_ERROR); } /** * @param UnencryptedToken $token * @return void */ public function setContext(UnencryptedToken $token): void { Context::set('current_admin_id',(int)$token->claims()?->get(RegisteredClaims::ID) ?? 0); } }