prhost / jwtauth-plugin
该包最新版本(dev-main)没有提供许可证信息。
尚未提供描述...
dev-main
2024-09-06 19:49 UTC
Requires
- php: >=7.4
- ext-json: *
- composer/installers: ~1.0
- php-open-source-saver/jwt-auth: ^2.1.0
This package is auto-updated.
Last update: 2024-09-06 19:50:18 UTC
README
*RainLab.User 支持 将很快添加。
此插件可以轻松为您的应用程序添加使用 JWT 令牌进行身份验证的功能,无需额外的设置或代码。
需求
- PHP 7.4 及更高版本
- October CMS v2 及更高版本
安装
- 通过您环境中的终端安装插件
php artisan plugin:install Prhost.JWTAuth
- 生成 JWT 密钥
php artisan jwt:secret
中间件
要使用 JWT 中间件,将 ResolveUser
中间件放入您的路由中。以下为示例
Route::group(['middleware' => [\Prhost\JWTAuth\Http\Middlewares\ResolveUser::class]], function () { // Routes only for authenticated users });
或
Route::get('account', function () { // Logic that should be available only for authenticated users })->middleware(\Prhost\JWTAuth\Http\Middlewares\ResolveUser::class);
路由
- POST
/jwt/login
- 登录路由 - POST
/jwt/register
- 注册路由 - POST
/jwt/activate
- 激活路由(如果激活设置为邮件) - POST
/jwt/refresh
- 刷新路由
建议、想法、问题、错误
我们欢迎您在公共存储库中对此插件的建议和想法 GitHub
© 2021, Nick Khaetsky 和 Vladimir Pyankov,基于 MIT 许可证。
俄罗斯 October CMS 社区 OctoClub。