Download the PHP package magoumi/idci-keycloak-security-bundle without Composer
On this page you can find all versions of the php package magoumi/idci-keycloak-security-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download magoumi/idci-keycloak-security-bundle
More information about magoumi/idci-keycloak-security-bundle
Files in magoumi/idci-keycloak-security-bundle
Package idci-keycloak-security-bundle
Short Description Allows you to easily handle you application security thanks to keycloak. apparently i have to make it force https(wink wink)
License CECILL-C
Informations about the package idci-keycloak-security-bundle
IDCI Keycloak Security Bundle
This Symfony bundle is an alternative solution to FOSUserBundle, working with keycloak.
For symfony 2/3/4 use version 1.2.0 For symfony 5+ use version 2.0.0 or +
Installation
With composer:
Configuration
If you want to set up keycloak locally you can download it here and follow instructions from the official documentation. In case that you want to use keycloak in docker go directly to configuration for Docker.
Bundle configuration
Basic
In case of you already have keycloak running locally on your machine or is running remotely but without proxy, here is the default configuration you should use:
Docker
If you want to use keycloak in docker you can base your stack on this sample.
Here is a stack example configuration for docker swarm:
Make sure that your php container in the container is attached to a network with keycloak, otherwise it will not be able to resolve "http://keycloak:8080/auth" and the public_server_url must be accessible through the port 80 because keycloak verify the issuer.
NOTE: The keycloak api endpoint as change, so if you used an old version, add the /auth
to you url:
Route configuration
Create a new file in to load pre configured bundle routes.
This will add the following routes to your application:
Symfony security configuration
To link keycloak with symfony you must configure your application security file.
Here is a simple configuration that restrict access to routes only to user with roles "ROLE_USER" or "ROLE_ADMIN" :
Note:
If you wish to secure your application using OAuth 2 Authorization Code Flow for route starting with /admin
, you will have to put the provided bundle routes behind the firewall, so here is an example on how to do this:
Keycloak configuration
If you need help to use keycloak because it is the first time you work on it, we've made a little tutorial step by step describing a basic configuration of a keycloak realm:
- Keycloak older than 19.0.0
- Keycloak equal or newer than 19.0.0
Logout
To logout users, use the route 'idci_keycloak_security_auth_logout':
Keycloak user account space
If you wants to provide a link to access keycloak user account space, use the route 'idci_keycloak_security_auth_account':
All versions of idci-keycloak-security-bundle with dependencies
symfony/framework-bundle Version ^5.3|^6.0
symfony/http-client Version ^5.3|^6.0
symfony/routing Version ^5.3|^6.0
symfony/security-bundle Version ^5.3|^6.0
symfony/http-foundation Version ^5.3|^6.0
knpuniversity/oauth2-client-bundle Version ^2.0