raditzfarhan / fimm-keycloak
A simple Keycloak package to manage access level for FIMM system.
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-12-17 19:09:58 UTC
README
A simple keycloak package for FIMM to manage the access control. This package will contain the Role middleware so that each route can be configured to be accessed by certain roles only.
Installation
You can install the package via composer:
composer require raditzfarhan/fimm-keycloak
Configuration
First you will need to add the role middleware to the Kernel in route middleware section.
protected $routeMiddleware = [ ... 'role' => \RaditzFarhan\FimmKeycloak\Middleware\KeycloakRole::class, ];
Then set the default Client ID in .env
FIMM_KEYCLOAK_CLIENT_ID=fimm-app
Usage
Then you can start using the role
middleware in your route.
// 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 });
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email raditzfarhan@gmail.com instead of using the issue tracker.
Credits
- Farhan - raditzfarhan@gmail.com
License
The MIT License (MIT). Please see License File for more information.