承接 lanos/laravel-auth0-multi-tenancy-management 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lanos/laravel-auth0-multi-tenancy-management

Composer 安装命令:

composer require lanos/laravel-auth0-multi-tenancy-management

包简介

Offers a collection of elegant interface classes to Auth0 Management API

README 文档

README

Laravel Auth0 Multi Tenancy Management

This is deprecated now as since first creating this Auth0 improved their SDK to include comprheensive Admin API support.

Intro

This package was built to sit alongside the main auth0 package. Unfortunately that package has limited management API capabilities / facades. This package aims to remedy that.

Progress

So far the following items are working:

  • Authentication
  • User Management
  • Branding Management
  • Organization Management
As I complete other modules, they will be listed above. If anyone from Auth0 wishes to merge this extra functionality into the main package, please feel free to fork and extract what you need, all I ask is to be credited.

Documentation Notes

More comprehensive documentation will be written eventually, I'm working on this in my spare time, so you'll need ot bare with me.

For now i'll explain the simple premise. I've essentially created static functions for each endpoint on the API documentation.

Data Formatting

Unless specified otherwise, all POST endpoints that require body data should be posted exactly as outlined in the corresponding documentation (you can post it as an associated array and the package will convert it to JSON). The same goes for query parameters, all is exactly as the documentation

Authentication Setup

You will need a machine to machine application (client) set up within your auth0 tenant that has management api access. Ideally you should use an application that only accesses the management API, that way any tokens generated from these interactions will not eat into your M2M quote.

You can just set these in .env as follows:

AUTH0_MGMT_CLIENT_ID=
AUTH0_MGMT_CLIENT_SECRET=
AUTH0_MGMT_DOMAIN=
AUTH0_MGMT_AUDIENCE=

The reason for the slightly different env variables is that you may wish to use a separate application to authenticate your users and act as your API. Which is recommended as stated above due to token quotas.

Examples

Once you have added the .env variables you should be good to go. When you make your first request, the package will automatically get a token using the above credentials and store it in cache. Any subsequent requests will not require this unless of course the token has expired, then the package will get a new token.

Each of the endpoint entities is available as an importable class. Given the generic nature of the class naming conventions, it seemed controversial to create these as pre-imported facades as they may conflict with other packages.

Once I have more time I will explore this, for now it's no harm to import the class.

Get Users

<?php

use Lanos\Auth0MultiManagement\Modules\User

public function getUsers(){

    $users = User::get();
    
    // Alternatively you can apply query paramters as desired
    
    $queryParams = [
        "page" => 2,
        "per_page" => 20
    ];
    
    // This will get page 2 of the results with 20 per page
    $paginated = User::get($queryParams);

}

Get User Organizations

Gets the tenants / organizations a user belongs to. Handy for multi tenant applications. Again, has the same pagination query param options.

<?php

import Lanos\Auth0MultiManagement\Modules\User

public function getUserOrganizations($userID){

    $userOrganizations = User::organizations($userID);
    
    // Alternatively you can apply query paramters as desired
    
    $queryParams = [
        "page" => 2,
        "per_page" => 20
    ];
    
    // This will get page 2 of the results with 20 per page
    $paginated = User::organizations($queryParams);

}

Add Users To An Organization

<?php

import Lanos\Auth0MultiManagement\Modules\Organization

public function addUsesrToOrganization($organizationID){

    $user_ids = [
        "auth0|507f1f77bcf86cd799439020",
        "auth0|507f1f77bcf86cd198439125",
    ];

    $addUser = Organization::addMembers($organizationID, $user_ids);

    // THIS WILL ADD THE 2 ABOVE USER IDS TO THIS ORGANIZATION

}

License

Please refer to LICENSE.md for this project's license.

lanos/laravel-auth0-multi-tenancy-management 适用场景与选型建议

lanos/laravel-auth0-multi-tenancy-management 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 53 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 01 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「Authentication」 「laravel」 「multi-tenant」 「auth0」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 lanos/laravel-auth0-multi-tenancy-management 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lanos/laravel-auth0-multi-tenancy-management 我们能提供哪些服务?
定制开发 / 二次开发

基于 lanos/laravel-auth0-multi-tenancy-management 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-23