raditzfarhan / fimm-keycloak
用于管理 FIMM 系统访问级别的简单 Keycloak 包。
0.0.0
2021-09-17 11:38 UTC
Requires
- php: ^7.4|^8.0
- illuminate/support: ^8.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-17 18:39:20 UTC
README
这是一个简单的 FIMM Keycloak 包,用于管理访问控制。此包将包含角色中间件,以便可以将每个路由配置为仅由特定角色访问。
安装
您可以通过 composer 安装此包。
composer require raditzfarhan/fimm-keycloak
配置
首先,您需要将角色中间件添加到 Kernel 的路由中间件部分。
protected $routeMiddleware = [ ... 'role' => \RaditzFarhan\FimmKeycloak\Middleware\KeycloakRole::class, ];
然后在 .env 中设置默认的 Client ID。
FIMM_KEYCLOAK_CLIENT_ID=fimm-app
用法
然后您可以在您的路由中使用 role 中间件。
// The routes in this group will only be accessible by consultant role Route::middleware(['role:consultant'])->group(function () { // your routes here }); // The routes in this group will only be accessible by fimm_admin or consultant role Route::middleware(['role:fimm_admin|consultant'])->group(function () { // your code here }); // If by any reason you need to use a different client, just append the client name using @ symbol // The routes in this group will only be accessible by distributor_admin role from another-app client Route::middleware(['role:distributor_admin@another-app'])->group(function () { // your code here });
测试
composer test
变更日志
请参阅 CHANGELOG 以获取有关最近更改的更多信息。
贡献
请参阅 CONTRIBUTING 以获取详细信息。
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件 raditzfarhan@gmail.com 而不是使用问题跟踪器来报告。
鸣谢
- Farhan - raditzfarhan@gmail.com
许可
MIT 许可证 (MIT)。请参阅 许可文件 以获取更多信息。