mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 18:17:49 +08:00
feat : jwt
This commit is contained in:
@@ -31,34 +31,20 @@ return [
|
||||
],
|
||||
'claims' => [
|
||||
// 默认的jwt claims
|
||||
RegisteredClaims::ISSUER => (string) env('APP_NAME'),
|
||||
RegisteredClaims::ISSUER => (string) env('APP_NAME') . '_default',
|
||||
RegisteredClaims::AUDIENCE => 'default', // 明确标识受众
|
||||
],
|
||||
],
|
||||
'admin' => [
|
||||
// jwt 配置 https://lcobucci-jwt.readthedocs.io/en/latest/
|
||||
'driver' => Jwt::class,
|
||||
// jwt 签名key
|
||||
'key' => InMemory::base64Encoded(env('JWT_SECRET')),
|
||||
// jwt 签名算法 可选 https://lcobucci-jwt.readthedocs.io/en/latest/supported-algorithms/
|
||||
'alg' => new Sha256(),
|
||||
// token过期时间,单位为秒
|
||||
'ttl' => (int) env('ADMIN_JWT_TTL', 3600),
|
||||
'ttl' => (int) env('ADMIN_JWT_TTL', 1),
|
||||
// 刷新token过期时间,单位为秒
|
||||
'refresh_ttl' => (int) env('ADMIN_JWT_REFRESH_TTL', 7200),
|
||||
// 黑名单模式
|
||||
'blacklist' => [
|
||||
// 是否开启黑名单
|
||||
'enable' => true,
|
||||
// 黑名单缓存前缀
|
||||
'prefix' => 'jwt_blacklist',
|
||||
// 黑名单缓存驱动
|
||||
'connection' => 'default',
|
||||
// 黑名单缓存时间 该时间一定要设置比token过期时间要大一点,最好设置跟过期时间一样
|
||||
'ttl' => (int) env('ADMIN_JWT_BLACKLIST_TTL', 7201),
|
||||
],
|
||||
'refresh_ttl' => (int) env('ADMIN_JWT_REFRESH_TTL', 10),
|
||||
'claims' => [
|
||||
// 默认的jwt claims
|
||||
RegisteredClaims::ISSUER => 'ADMIN'. env('APP_NAME'),
|
||||
RegisteredClaims::ISSUER => (string) env('APP_NAME') .'_admin',
|
||||
],
|
||||
],
|
||||
// 在你想要使用不同的场景时,可以在这里添加配置.可以填一个。其他会使用默认配置
|
||||
|
||||
Reference in New Issue
Block a user