1. Go to this page and download the library: Download uisits/laravel-oidc 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/ */
uisits / laravel-oidc example snippets
> In AuthServiceProvider:
> Gate::define('admin', function (User $user) {
> return $user->hasRole('admin');
> });
>
> To check if user is admin you can either use:
> User::find()->hasRole
>
> OR
>
> Gate::allows('admin')
>
use UisIts\Oidc\Http\Middleware\Introspect;
Route::middleware(['introspect'])->get('/introspect', function (Request $request) {
dump($request->bearerToken());
dd(Introspect::getUserFromToken($request->bearerToken()));
})->name('introspect');