mostbyte/auth

来自身份服务的Mostbyte授权系统

3.1.2 2024-07-23 10:32 UTC

This package is auto-updated.

Last update: 2024-09-23 10:48:54 UTC


README

来自身份服务的Mostbyte授权系统

版本

安装

要获取 Mostbyte auth 的最新版本,只需使用 Composer 需求项目即可

composer require mostbyte/auth

当然,您也可以手动更新require块并运行 composer update,如果您选择这样做的话

{
  "require": {
    "mostbyte/auth": "^3.0"
  }
}

发布配置文件

php artisan vendor:publish --provider="Mostbyte\Auth\AuthServiceProvider"

警告:在生产环境中,在 .env 中您应该指定 LOCAL_DEVELOPMENT=false。否则,您所有的HTTP请求都将由faker处理

使用方法

在路由中使用

use Mostbyte\Auth\Middleware\IdentityAuth;

Route::middleware(IdentityAuth::class)->get("foo", function () {
    return "bar";
});

或者在 App\Http\Kernel.php 中指定

protected $middlewareAliases = [
    // other middlewares...
    "identity" => \Mostbyte\Auth\Middleware\IdentityAuth::class
];

并在路由中

Route::middleware('identity')->get("foo", function () {
    return "bar";
});