定制 devianl2/service-logging 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

devianl2/service-logging

最新稳定版本:1.0.1

Composer 安装命令:

composer require devianl2/service-logging

包简介

Microservice logging

README 文档

README

Tenant auth is a laravel package that validate JWT token and its claim properties and set into request header

For each microservice development, you need to follow instruction below to ensure the application is standardize.

Step 1:

Install from composer

composer require devianl2/tenant-auth

Run the following command for public key config

php artisan vendor:publish --provider="Tenant\Auth\TenantAuthProvider"

Step 2:

To use this package, make sure any API request does have Authorization header and Web request does have Authorization key in cookie

Go to App\Http\Middleware\Kernel and add the following syntax

 protected $middleware = [
        // \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        ...
        **\Tenant\Auth\Middleware\TenantAuthMiddleware::class**
    ];

Step 3 (Optional:

If you are using in $routeMiddleware and define the middleware group by your own, you may do the following action:

Go to App\Http\Kernel to add your own route middleware like following:

protected $routeMiddleware = [
        .....
        'tenant-auth'   =>  \Tenant\Auth\Middleware\TenantAuthMiddleware::class
    ];

Go to App\Http\Middleware\EncryptCookies and add Authorization into except array because Laravel Cookie has encrpytion for all values by default but the Authorization token encrpytion is not needed in this case since it was generated by gateway.

protected $except = [
        'Authorization'
    ];

Go to App\Http\Middleware\Kernel and add the following syntax

 protected $middleware = [
        // \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        ...
        **\Tenant\Auth\Middleware\TenantAuthMiddleware::class**
    ];

Note:

This package will automatic extract the following information if JWT token is valid:

  • x-user-uuid (Current user's uuid)
  • x-tenant-uuid (Current user's tenant id)
  • x-tenant-url (Current user's tenant url)
  • x-scopes (Current user's permissions / json encoded)
  • x-roles (Current user's roles. E.g: admin/users. / Json encoded)
  • x-modules (Module that user could access / json encoded)

You may use $request to extract the information in controller E.g $request->header('x-user-uuid');

统计信息

  • 总下载量: 60
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-11