build: 添加 hyperf-auth 依赖并更新 composer.lock

test
yinxiaolong 1 month ago
parent 8fc144fc9f
commit 4bcb946f2e

@ -13,9 +13,13 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"require": { "require": {
"php": ">=8.1", "php": ">=8.1",
"96qbhy/hyperf-auth": "^3.1",
"hyperf/async-queue": "~3.1.0",
"hyperf/cache": "~3.1.0", "hyperf/cache": "~3.1.0",
"hyperf/command": "~3.1.0", "hyperf/command": "~3.1.0",
"hyperf/config": "~3.1.0", "hyperf/config": "~3.1.0",
"hyperf/constants": "~3.1.0",
"hyperf/database": "~3.1.0",
"hyperf/db-connection": "~3.1.0", "hyperf/db-connection": "~3.1.0",
"hyperf/engine": "^2.10", "hyperf/engine": "^2.10",
"hyperf/framework": "~3.1.0", "hyperf/framework": "~3.1.0",
@ -23,12 +27,9 @@
"hyperf/http-server": "~3.1.0", "hyperf/http-server": "~3.1.0",
"hyperf/logger": "~3.1.0", "hyperf/logger": "~3.1.0",
"hyperf/memory": "~3.1.0", "hyperf/memory": "~3.1.0",
"hyperf/model-cache": "~3.1.0",
"hyperf/process": "~3.1.0", "hyperf/process": "~3.1.0",
"hyperf/database": "~3.1.0", "hyperf/redis": "~3.1.0"
"hyperf/redis": "~3.1.0",
"hyperf/constants": "~3.1.0",
"hyperf/async-queue": "~3.1.0",
"hyperf/model-cache": "~3.1.0"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^3.0", "friendsofphp/php-cs-fixer": "^3.0",

269
composer.lock generated

@ -4,8 +4,169 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "4f70c499087e9d68e62ac1d667e47b05", "content-hash": "ecaacd4dde949506185ea2276bffaa39",
"packages": [ "packages": [
{
"name": "96qbhy/hyperf-auth",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/qbhy/hyperf-auth.git",
"reference": "0252048d758c1c793ebe6448f3fd744e4e2c7793"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/qbhy/hyperf-auth/zipball/0252048d758c1c793ebe6448f3fd744e4e2c7793",
"reference": "0252048d758c1c793ebe6448f3fd744e4e2c7793",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"96qbhy/simple-jwt": "^v1.5",
"ext-json": "*",
"ext-redis": "*",
"hyperf/cache": "^3.1",
"hyperf/di": "^3.1",
"php": ">=8.1"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.8",
"friendsofphp/php-cs-fixer": "^2.14",
"hyperf/command": "^3.1",
"hyperf/config": "^3.1",
"hyperf/database": "^3.1",
"hyperf/event": "^3.1",
"hyperf/framework": "^3.1",
"hyperf/redis": "^3.1",
"hyperf/session": "^3.1",
"hyperf/testing": "^3.1",
"hyperf/utils": "^3.1",
"itsgoingd/clockwork": "^5.0",
"phpstan/phpstan": "^0.12",
"swoft/swoole-ide-helper": "dev-master",
"symfony/console": "^5.3",
"symfony/var-dumper": "^5.3"
},
"suggest": {
"ext-redis": "*"
},
"type": "library",
"extra": {
"hyperf": {
"config": "Qbhy\\HyperfAuth\\ConfigProvider"
},
"hooks": {
"pre-commit": [
"echo committing as $(git config user.name)",
"vendor/bin/php-cs-fixer fix .",
"git add .",
"composer test"
]
}
},
"autoload": {
"files": [
"src/helper.php"
],
"psr-4": {
"Qbhy\\HyperfAuth\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "hyperf 的 auth 组件",
"keywords": [
"hyperf",
"hyperf-auth",
"jwt-auth",
"php"
],
"support": {
"issues": "https://github.com/qbhy/hyperf-auth/issues",
"source": "https://github.com/qbhy/hyperf-auth/tree/v3.1.2"
},
"time": "2024-01-11T04:45:43+00:00"
},
{
"name": "96qbhy/simple-jwt",
"version": "v1.5",
"source": {
"type": "git",
"url": "https://github.com/qbhy/simple-jwt.git",
"reference": "5ed9564af7151f2cecc19249ffac4c697e5a7efb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/qbhy/simple-jwt/zipball/5ed9564af7151f2cecc19249ffac4c697e5a7efb",
"reference": "5ed9564af7151f2cecc19249ffac4c697e5a7efb",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"doctrine/cache": "^1.10",
"ext-json": ">=1.0",
"php": ">=8.1"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.8",
"friendsofphp/php-cs-fixer": "^3.0",
"hyperf/config": "^3.1",
"hyperf/context": "~3.1.0",
"phpunit/phpunit": "^10.0.0"
},
"type": "library",
"extra": {
"hooks": {
"pre-commit": [
"echo committing as $(git config user.name)",
"vendor/bin/php-cs-fixer fix .",
"git add .",
"composer test"
]
},
"hyperf": {
"config": "Qbhy\\SimpleJwt\\Hyperf\\ConfigProvider"
},
"laravel": {
"providers": [
"Qbhy\\SimpleJwt\\Laravel\\ServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Qbhy\\SimpleJwt\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "96qbhy",
"email": "96qbhy@gmail.com"
}
],
"description": "简单的 jwt 实现",
"support": {
"issues": "https://github.com/qbhy/simple-jwt/issues",
"source": "https://github.com/qbhy/simple-jwt/tree/v1.5"
},
"time": "2023-12-05T08:17:09+00:00"
},
{ {
"name": "carbonphp/carbon-doctrine-types", "name": "carbonphp/carbon-doctrine-types",
"version": "3.2.0", "version": "3.2.0",
@ -81,6 +242,112 @@
], ],
"time": "2024-02-09T16:56:22+00:00" "time": "2024-02-09T16:56:22+00:00"
}, },
{
"name": "doctrine/cache",
"version": "1.13.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "56cd022adb5514472cb144c087393c1821911d09"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/56cd022adb5514472cb144c087393c1821911d09",
"reference": "56cd022adb5514472cb144c087393c1821911d09",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "~7.1 || ^8.0"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"alcaeus/mongo-php-adapter": "^1.1",
"cache/integration-tests": "dev-master",
"doctrine/coding-standard": "^9",
"mongodb/mongodb": "^1.1",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"predis/predis": "~1.0",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"symfony/cache": "^4.4 || ^5.4 || ^6",
"symfony/var-exporter": "^4.4 || ^5.4 || ^6"
},
"suggest": {
"alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.",
"homepage": "https://www.doctrine-project.org/projects/cache.html",
"keywords": [
"abstraction",
"apcu",
"cache",
"caching",
"couchdb",
"memcached",
"php",
"redis",
"xcache"
],
"support": {
"issues": "https://github.com/doctrine/cache/issues",
"source": "https://github.com/doctrine/cache/tree/1.13.0"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache",
"type": "tidelift"
}
],
"abandoned": true,
"time": "2022-05-20T20:06:54+00:00"
},
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
"version": "2.0.10", "version": "2.0.10",

@ -0,0 +1,183 @@
<?php
declare(strict_types=1);
/**
* This file is part of qbhy/hyperf-auth.
*
* @link https://github.com/qbhy/hyperf-auth
* @document https://github.com/qbhy/hyperf-auth/blob/master/README.md
* @contact qbhy0715@qq.com
* @license https://github.com/qbhy/hyperf-auth/blob/master/LICENSE
*/
use Qbhy\SimpleJwt\Encoders;
use Qbhy\SimpleJwt\EncryptAdapters as Encrypter;
use function Hyperf\Support\env;
use function Hyperf\Support\make;
return [
'default' => [
'guard' => 'jwt',
'provider' => 'users',
],
'guards' => [
'sso' => [
// 支持的设备env配置时用英文逗号隔开
'clients' => explode(',', env('AUTH_SSO_CLIENTS', 'pc')),
// hyperf/redis 实例
'redis' => function () {
return make(\Hyperf\Redis\Redis::class);
},
// 自定义 redis key必须包含 {uid}{uid} 会被替换成用户ID
'redis_key' => 'u:token:{uid}',
'driver' => Qbhy\HyperfAuth\Guard\SsoGuard::class,
'provider' => 'users',
/*
* 以下是 simple-jwt 配置
* 必填
* jwt 服务端身份标识
*/
'secret' => env('SSO_JWT_SECRET'),
/*
* 可选配置
* jwt 默认头部token使用的字段
*/
'header_name' => env('JWT_HEADER_NAME', 'Authorization'),
/*
* 可选配置
* jwt 生命周期,单位秒,默认一天
*/
'ttl' => (int) env('SIMPLE_JWT_TTL', 60 * 60 * 24),
/*
* 可选配置
* 允许过期多久以内的 token 进行刷新,单位秒,默认一周
*/
'refresh_ttl' => (int) env('SIMPLE_JWT_REFRESH_TTL', 60 * 60 * 24 * 7),
/*
* 可选配置
* 默认使用的加密类
*/
'default' => Encrypter\SHA1Encrypter::class,
/*
* 可选配置
* 加密类必须实现 Qbhy\SimpleJwt\Interfaces\Encrypter 接口
*/
'drivers' => [
Encrypter\PasswordHashEncrypter::alg() => Encrypter\PasswordHashEncrypter::class,
Encrypter\CryptEncrypter::alg() => Encrypter\CryptEncrypter::class,
Encrypter\SHA1Encrypter::alg() => Encrypter\SHA1Encrypter::class,
Encrypter\Md5Encrypter::alg() => Encrypter\Md5Encrypter::class,
],
/*
* 可选配置
* 编码类
*/
'encoder' => new Encoders\Base64UrlSafeEncoder(),
// 'encoder' => new Encoders\Base64Encoder(),
/*
* 可选配置
* 缓存类
*/
'cache' => new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir()),
// 如果需要分布式部署,请选择 redis 或者其他支持分布式的缓存驱动
// 'cache' => function () {
// return make(\Qbhy\HyperfAuth\HyperfRedisCache::class);
// },
/*
* 可选配置
* 缓存前缀
*/
'prefix' => env('SIMPLE_JWT_PREFIX', 'default'),
],
'jwt' => [
'driver' => Qbhy\HyperfAuth\Guard\JwtGuard::class,
'provider' => 'users',
/*
* 以下是 simple-jwt 配置
* 必填
* jwt 服务端身份标识
*/
'secret' => env('SIMPLE_JWT_SECRET'),
/*
* 可选配置
* jwt 默认头部token使用的字段
*/
'header_name' => env('JWT_HEADER_NAME', 'Authorization'),
/*
* 可选配置
* jwt 生命周期,单位秒,默认一天
*/
'ttl' => (int) env('SIMPLE_JWT_TTL', 60 * 60 * 24),
/*
* 可选配置
* 允许过期多久以内的 token 进行刷新,单位秒,默认一周
*/
'refresh_ttl' => (int) env('SIMPLE_JWT_REFRESH_TTL', 60 * 60 * 24 * 7),
/*
* 可选配置
* 默认使用的加密类
*/
'default' => Encrypter\SHA1Encrypter::class,
/*
* 可选配置
* 加密类必须实现 Qbhy\SimpleJwt\Interfaces\Encrypter 接口
*/
'drivers' => [
Encrypter\PasswordHashEncrypter::alg() => Encrypter\PasswordHashEncrypter::class,
Encrypter\CryptEncrypter::alg() => Encrypter\CryptEncrypter::class,
Encrypter\SHA1Encrypter::alg() => Encrypter\SHA1Encrypter::class,
Encrypter\Md5Encrypter::alg() => Encrypter\Md5Encrypter::class,
],
/*
* 可选配置
* 编码类
*/
'encoder' => new Encoders\Base64UrlSafeEncoder(),
// 'encoder' => new Encoders\Base64Encoder(),
/*
* 可选配置
* 缓存类
*/
'cache' => new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir()),
// 如果需要分布式部署,请选择 redis 或者其他支持分布式的缓存驱动
// 'cache' => function () {
// return make(\Qbhy\HyperfAuth\HyperfRedisCache::class);
// },
/*
* 可选配置
* 缓存前缀
*/
'prefix' => env('SIMPLE_JWT_PREFIX', 'default'),
],
'session' => [
'driver' => Qbhy\HyperfAuth\Guard\SessionGuard::class,
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => \Qbhy\HyperfAuth\Provider\EloquentProvider::class,
'model' => App\Model\User::class, // 需要实现 Qbhy\HyperfAuth\Authenticatable 接口
],
],
];
Loading…
Cancel
Save