PHPackages                             1-0-0-1/laravel-keycloak-extended-guard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. 1-0-0-1/laravel-keycloak-extended-guard

ActiveLibrary

1-0-0-1/laravel-keycloak-extended-guard
=======================================

Keycloak Guard for Laravel with remote validation

1.3.0(4y ago)021proprietaryPHPPHP &gt;=7.4

Since Feb 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AlexeyShchetkin/laravel-keycloak-extended-guard)[ Packagist](https://packagist.org/packages/1-0-0-1/laravel-keycloak-extended-guard)[ Docs](https://github.com/1-0-0-1/laravel-keycloak-extended-guard)[ RSS](/packages/1-0-0-1-laravel-keycloak-extended-guard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

Keycloak Extended Guard for Laravel
===================================

[](#keycloak-extended-guard-for-laravel)

This package helps you authenticate users on a Laravel API based on JWT tokens generated from Keycloak Server with remote checks.

Install
=======

[](#install)

Require the package

```
composer require AlexeyShchetkin/laravel-keycloak-extended-guard

```

Configuration
=============

[](#configuration)

Laravel Auth
------------

[](#laravel-auth)

Changes on `config/auth.php`

```
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],
    'keycloak' => [ #  'keycloak',
        'provider' => 'users',
    ],
```

Laravel Routes
--------------

[](#laravel-routes)

Just protect some endpoints on `routes/api.php` and you are done!

```
// public endpoints
Route::get('/hello', function () {
    return ':)';
});

// protected endpoints
Route::middleware('auth:keycloak')->post('/secret_page', function () {
    return 'Welcome to secret place';
});
```

Keycloak Guard
--------------

[](#keycloak-guard)

The Keycloak Extended Guard configuration can be handled from Laravel `.env` file. Be sure all strings **are trimmed.**

Optionally you can publish the config file.

```
php artisan vendor:publish  --provider="KeycloakExtendedGuard\KeycloakExtendedGuardServiceProvider"

```

```
