Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/typo3gmbh/symfony-keycloak-bundle
https://github.com/typo3gmbh/symfony-keycloak-bundle
symfony symfony-bundle
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/typo3gmbh/symfony-keycloak-bundle
- Owner: TYPO3GmbH
- License: mit
- Created: 2020-02-18T07:52:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-09T15:09:30.000Z (4 months ago)
- Last Synced: 2024-09-10T10:52:48.242Z (4 months ago)
- Topics: symfony, symfony-bundle
- Language: PHP
- Size: 76.2 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Installation
## Step 1: Download the Bundle
Open a command console, enter your project directory and execute the
following command to download the latest stable version of this bundle:```console
$ composer require t3g/symfony-keycloak-bundle
```## Step 2: Add the firewall to security.yaml
Update your security.yaml like this
```yaml
# config/packages/security.yaml
security:
enable_authenticator_manager: true
providers:
keycloak:
id: keycloak.typo3.com.user.provider
firewalls:
main:
provider: keycloak
logout:
path: /logout
target: home
custom_authenticators:
- T3G\Bundle\Keycloak\Security\KeyCloakAuthenticator
``````yaml
# config/routes.yaml
logout:
path: /logoutlogin:
alias: t3g_keycloak_login
```## Step 3: Enable the Bundle
Then, enable the bundle and its dependencies by adding it to the list of registered bundles
in the `config/bundles.php` file of your project:**NOTE**: The order is *very* important here.
```php
// config/bundles.phpreturn [
// ...
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle::class => ['all' => true],
Http\HttplugBundle\HttplugBundle::class => ['all' => true],
T3G\Bundle\Keycloak\T3GKeycloakBundle::class => ['all' => true],
];
```# Configuration
```bash
# displays the default config values
php bin/console config:dump-reference t3g_keycloak# displays the actual config values used by your application
php bin/console debug:config t3g_keycloak
```## Default configuration
```yaml
# Default configuration for extension with alias: "t3g_keycloak"
t3g_keycloak:
keycloak:
user_provider_class: T3G\Bundle\Keycloak\Security\KeyCloakUserProvider
default_roles:
# Defaults:
- ROLE_USER
- ROLE_OAUTH_USER
clientId: '%env(KEYCLOAK_CLIENT_ID)%'
```### Role Mapping
```yaml
t3g_keycloak:
keycloak:
role_mapping:
my-role: ROLE_ADMIN
```### Routes
```yaml
t3g_keycloak:
routes:
# route to redirect to after successful authentication
success: home
# redirect_route passed to keycloak
authentication: t3g_keycloak_oauthCallback
```