Package Data | |
---|---|
Maintainer Username: | ari-salt |
Maintainer Contact: | aristo.rinjuang@salt.co.id (ari-salt) |
Package Create Date: | 2023-09-29 |
Package Last Update: | 2023-10-19 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-04-29 15:10:06 |
Package Statistics | |
---|---|
Total Downloads: | 150 |
Monthly Downloads: | 6 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A Laravel/Lumen middleware to authorize requests using CIAM ForgeRock.
$ composer require ari-salt/auth-middleware
Add these environments to your app. CIAM_AUDIENCES
and CIAM_ISS
are arrays of strings separated by commas.
CIAM_ALGORITHM=""
CIAM_AUDIENCES=""
CIAM_CACHE_EXPIRATION_HOURS=24
CIAM_CLIENT_ID=""
CIAM_HOST=""
CIAM_HTTP_TIMEOUT=3
CIAM_ISS=""
PEM_PUBLIC_KEY=""
Register middlewares to the routes.
use AriSALT\AuthMiddleware\AuthOfflineMiddleware;
use AriSALT\AuthMiddleware\AuthOnlineMiddleware;
$app->routeMiddleware([
'auth_offline' => AuthOfflineMiddleware::class,
'auth_online' => AuthOnlineMiddleware::class
]);
Apply them to the routes.
$router->get('/test', [
'middleware' => [
'auth_offline:memberForgeRock,VERIFY_TOKEN,forge-rock',
// 'member:memberForgeRock,memberPimcore,VERIFY_TOKEN,forge-rock',
],
'uses' => 'ExampleController@index'
]);
Then, you can use it on your handlers.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ExampleController extends Controller
{
public function index(Request $request)
{
var_dump($request->get('memberForgeRock'));
}
}