Skip to content

Commit

Permalink
feat: add JWT alias and jwt/auth config
Browse files Browse the repository at this point in the history
  • Loading branch information
albertcht committed Aug 9, 2023
1 parent 3b77e78 commit 17b0341
Show file tree
Hide file tree
Showing 7 changed files with 563 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ DB_PREFIX=
REDIS_HOST=localhost
REDIS_AUTH=(null)
REDIS_PORT=6379
REDIS_DB=0
REDIS_DB=0

JWT_SECRET=
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@
"hyperf/translation": "^3.1",
"hyperf/validation": "^3.1",
"psr/http-message": "^1.0",
"swooletw/hyperf-auth": "@dev",
"swooletw/hyperf-cache": "@dev",
"swooletw/hyperf-container": "@dev",
"swooletw/hyperf-encryption": "@dev",
"swooletw/hyperf-foundation": "@dev",
"swooletw/hyperf-hashing": "@dev",
"swooletw/hyperf-jwt": "@dev",
"swooletw/hyperf-log": "@dev",
"swooletw/hyperf-router": "@dev",
"swooletw/hyperf-sqlite": "@dev",
Expand Down
245 changes: 244 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions config/autoload/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
'Response' => SwooleTW\Hyperf\Support\Facades\Response::class,
'Translator' => SwooleTW\Hyperf\Support\Facades\Translator::class,
'Validator' => SwooleTW\Hyperf\Support\Facades\Validator::class,
'JWT' => SwooleTW\Hyperf\Support\Facades\JWT::class,
'Auth' => SwooleTW\Hyperf\Support\Facades\Auth::class,
'Hash' => SwooleTW\Hyperf\Support\Facades\Hash::class,
'Environment' => SwooleTW\Hyperf\Support\Facades\Environment::class,
],
];
26 changes: 26 additions & 0 deletions config/autoload/auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

return [
'defaults' => [
'guard' => 'jwt',
'provider' => 'users',
],
'guards' => [
'session' => [
'driver' => 'session',
'provider' => 'users',
],
'jwt' => [
'driver' => 'jwt',
'provider' => 'users',
]
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
],
];
Loading

0 comments on commit 17b0341

Please sign in to comment.