acsystems / keycloak-guard-bundle
Symfony guard authentication via keycloak JWT
Installs: 4 026
Dependents: 0
Suggesters: 0
Security: 0
Type:symfony-bundle
pkg:composer/acsystems/keycloak-guard-bundle
Requires
- php: >=7.3
- ext-json: *
- fproject/php-jwt: ^4.0
- symfony/security-bundle: ^5.4
- symfony/yaml: ^5.4
README
The goal of this bundle is to provide a Keycloak token authenticator guard for Symfony.
Superseded by acsystems/keycloak-authenticator-bundle
Documentation
Quick start
Installation
Install the package from packagist using composer
composer require acsystems/keycloak-guard-bundle
Add the bundle.
config/bundles.php
return [
ACSystems\KeycloakGuardBundle\ACSystemsKeycloakGuardBundle::class => ['all' => true]
];
Set up Symfony Security to use the custom authenticator.
config/packages/security.yaml
security:
providers:
keycloak:
id: ACSystems\KeycloakGuardBundle\Security\Provider\KeycloakUserProvider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
provider: keycloak
stateless: true
anonymous: true
logout: ~
guard:
authenticators:
- ACSystems\KeycloakGuardBundle\Security\KeycloakTokenAuthenticator
access_control:
# ...
Add your keycloak base url and realm
config/packages/keycloak_client.yaml:
acsystems_keycloak_guard:
keycloak_guard:
base_uri: 'https://example.com/'
realm: 'example-realm'
Configurable parameters
| Name | Type | Usage |
|---|---|---|
| base_uri | string | URL to your keycloak instance |
| realm | optional string | Realm name, will be derived if not present |
| client_id | optional string | Human readable client_id, will be derived if not present |
Upgrading
For version migrations instructions see upgrade instructions.
Supported platforms
These are the platforms which are officially supported by this package. Any other versions might work but is not guaranteed.
| Platform | Version |
|---|---|
| PHP | 7.4 / 8.1 |
| Symfony | 5.4 |
- For keycloak >= 17, use version ^2.0.0 of this package
- For Keycloak <= 16, use version ^1.4.0 of this package
- For Symfony >=6 use acsystems/keycloak-authenticator-bundle
Contributing
Please read our contribution guidelines before contributing.