PHP code example of erimeilis / laravel-multikeycloak-guard
1. Go to this page and download the library: Download erimeilis/laravel-multikeycloak-guard library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
erimeilis / laravel-multikeycloak-guard example snippets
// public endpoints
Route::get('/hello', function () {
return ':)';
});
// protected endpoints
Route::group(['middleware' => 'auth:api'], function () {
Route::get('/protected-endpoint', 'SecretController@index');
// more endpoints ...
});
// keycloak.php
'input_key' => 'api_token'
// If there is no Bearer token on request it will use `api_token` request param
GET $this->get("/foo/secret?api_token=xxxxx")
POST $this->post("/foo/secret", ["api_token" => "xxxxx"])
$token = Auth::token() // or Auth::user()->token()