bala / keycloak-roles-permission
This is for keycloak permission management
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/bala/keycloak-roles-permission
README
Api authorization for base on user Role
Installation
Install package with composer
composer require bala/Keycloak-roles-permission
Add Middleware to your kernal.php
protected $routeMiddleware = [ ... 'keycloak.role' => \Bala\Middleware\KeycloakRoleMiddleware::class ];
Add Variable to .env
KEYCLOAK_ROLE_CLIENT="KEYCLOAK CLIENT ID"
Usage
Authorize api with role
Route::get('example-protected-api', [ExampleController::class, 'index'])->middleware('keycloak.role:role name')
Authorize api with any role
Route::get('example-protected-api', [ExampleController::class, 'index'])->middleware('keycloak.role:role1|role2')