Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"phper666/jwt-auth": "~2.0.1" #23

Closed
250121244 opened this issue Jun 15, 2020 · 7 comments
Closed

"phper666/jwt-auth": "~2.0.1" #23

250121244 opened this issue Jun 15, 2020 · 7 comments

Comments

@250121244
Copy link

配置文件发布成功, 但是jwt类并没有使用发布成功的配置文件啊.

@250121244
Copy link
Author

CommonTrait类上的 @value 注解无效

@phper666
Copy link
Owner

@250121244 我这边测试是没有问题的,你使用的hyperf是哪个版本呢?而且建议使用3.0.x版本

@250121244
Copy link
Author

hyperf/amqp v1.1.30 A amqplib for hyperf.
hyperf/cache v1.1.30 A cache component for hyperf.
hyperf/command v1.1.26 Command for hyperf
hyperf/config v1.1.26 An independent component that provides configuration container.
hyperf/constants v1.1.26 A constants component for hyperf.
hyperf/contract v1.1.26 The contracts of Hyperf.
hyperf/crontab v1.1.26 A crontab component for Hyperf.
hyperf/database v1.1.31 A flexible database library.
hyperf/db-connection v1.1.26 A hyperf db connection handler for hyperf/database.
hyperf/devtool v1.1.31 A Devtool for Hyperf.
hyperf/di v1.1.28 A DI for Hyperf.
hyperf/dispatcher v1.1.26 A HTTP Server for Hyperf.
hyperf/event v1.1.26 an event manager that implements PSR-14.
hyperf/exception-handler v1.1.31 Exception handler for hyperf
hyperf/filesystem v1.1.31 flysystem integration for hyperf
hyperf/framework v1.1.27 A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.
hyperf/guzzle v1.1.26 Swoole coroutine handler for guzzle
hyperf/http-message v1.1.26 microservice framework base on swoole
hyperf/http-server v1.1.29 A HTTP Server for Hyperf.
hyperf/logger v1.1.26 A logger component for hyperf.
hyperf/memory v1.1.26 An independent component that use to operate and manage memory.
hyperf/model-cache v1.1.28 A model cache component for hyperf.
hyperf/model-listener v1.1.26 A model listener for Hyperf.
hyperf/paginator v1.1.26 A paginator component for hyperf.
hyperf/pool v1.1.26 An independent universal connection pool component.
hyperf/process v1.1.26 A process component for hyperf.
hyperf/redis v1.1.26 A redis component for hyperf.
hyperf/server v1.1.31 A base server library for Hyperf.
hyperf/session v1.1.26 A session library
hyperf/task v1.1.26 A task library for Hyperf.
hyperf/testing v1.1.28 Testing for hyperf
hyperf/translation v1.1.26 An independent translation component, forked by illuminate/translation.
hyperf/utils v1.1.31 A tools package that could help developer solved the problem quickly.
hyperf/validation v1.1.28 hyperf validation
hyperf/view v1.1.28 A view library for Hyperf.

@250121244
Copy link
Author

我自己实现一个Middleware.
public function __construct(ContainerInterface $container, Jwt $jwt)
{
$this->container = $container;
$this->jwt = $jwt;

    $this->jwt->loginType = config('jwt.login_type');
    $this->jwt->ssoKey = config('jwt.sso_key');
    $this->jwt->secret = config('jwt.secret');
    $this->jwt->keys = config('jwt.keys');
    $this->jwt->ttl = config('jwt.ttl');
    $this->jwt->alg = config('jwt.alg');
    $this->jwt->enalbed = config('jwt.blacklist_enabled');
    $this->jwt->gracePeriod = config('jwt.blacklist_grace_period');
    $this->jwt->cacheTTL = config('jwt.blacklist_cache_ttl');
}

@250121244
Copy link
Author

通过构造方法手动给jwt对象赋值.

@250121244
Copy link
Author

以下是我的composer.json
"require": {
"php": ">=7.2",
"ext-swoole": ">=4.4",
"hyperf/cache": "~1.1.0",
"hyperf/command": "~1.1.0",
"hyperf/config": "~1.1.0",
"hyperf/contract": "~1.1.0",
"hyperf/database": "~1.1.0",
"hyperf/db-connection": "^1.1",
"hyperf/devtool": "~1.1.0",
"hyperf/di": "~1.1.0",
"hyperf/dispatcher": "~1.1.0",
"hyperf/event": "~1.1.0",
"hyperf/exception-handler": "~1.1.0",
"hyperf/framework": "~1.1.0",
"hyperf/guzzle": "~1.1.0",
"hyperf/http-server": "~1.1.0",
"hyperf/logger": "~1.1.0",
"hyperf/memory": "~1.1.0",
"hyperf/paginator": "~1.1.0",
"hyperf/pool": "~1.1.0",
"hyperf/process": "~1.1.0",
"hyperf/redis": "~1.1.0",
"hyperf/utils": "~1.1.0",
"hyperf/validation": "^1.1",
"hyperf/testing": "^1.1",
"hyperf/constants": "^1.1",
"hyperf/crontab": "^1.1",
"hyperf/amqp": "^1.1",
"hyperf/view": "^1.1",
"hyperf/task": "^1.1",
"hyperf/session": "^1.1",
"hyperf/filesystem": "^1.1",
"xxtime/flysystem-aliyun-oss": "^1.5",
"duncan3dc/blade": "^4.8",
"hyperf/model-cache": "^1.1",
"phper666/jwt-auth": "~2.0.1"
},
"require-dev": {
"swoft/swoole-ide-helper": "^4.2",
"phpmd/phpmd": "^2.6",
"friendsofphp/php-cs-fixer": "^2.14",
"mockery/mockery": "^1.0",
"doctrine/common": "^2.9",
"phpstan/phpstan": "^0.11.2"
},

@phper666
Copy link
Owner

@250121244 更新到最新看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants