Download the PHP package colq2/laravel-keycloak without Composer

On this page you can find all versions of the php package colq2/laravel-keycloak. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-keycloak

IMPORTANT

This is going to be an easy-to-use keycloak adapter for laravel.

This is still in development and not ready for production.

Feel free to contribute to this.

To do

[ ] Allow different user storage's like Cache, Session, Eloquent, Database etc.

Installation

composer require colq2/laravel-keycloak

Publish config and migrations

php artisan vendor:publish --provider=colq2\Keycloak\KeycloakServiceProvider

This project redefines the user model and migrations. There is no need for password reset table. Furthermore we need another properties on the user (This are mostly the openid-connect defined properties):

You can delete all migrations in your laravel project if you want to use keycloak as the only auth possibility.

Add following to your .env file:

Usage

Controller:

Routes:

Middleware

This package comes with CheckRealmAccess and CheckResourceAccess middleware. You can add them in the app/Http/Kernel.php file.

Then you can use the middleware:

Realm Access Middleware

Resource Access Middleware

Custom User

The custom keycloak user saves the properties: id, sub, username, name, email and picture

To customize this you should do three things:

  1. Update migration
  2. Update User model
  3. Provide a custom Service

Update migrations

In the create_user_table migration you can add or remove your needed properties. By default you can use all claims that are defined in the openid-connect specs.

Update User Model

After you defined which properties you need. You have to define the same in the fillable attribute.

Provide a custom user service

The openid-connect claims have to be parsed to your custom properties. Just build a new class and extend the default User service. Then update the app binding to your user service.

In CustomUserService:

And bind this to your application in AppServiceProvider:


All versions of laravel-keycloak with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
illuminate/auth Version ^5.8
illuminate/cache Version ^5.8
illuminate/contracts Version 5.8
illuminate/session Version ^5.8
illuminate/support Version ^5.8
stevenmaguire/oauth2-keycloak Version dev-master
lcobucci/jwt Version ^3.2
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package colq2/laravel-keycloak contains the following files

Loading the files please wait ....