• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TYPO3GmbH / symfony-keycloak-bundle / 14440650663

14 Apr 2025 08:09AM UTC coverage: 4.425% (-0.3%) from 4.739%
14440650663

push

github

web-flow
[BUGFIX] Redirect to Symfony's logout route (#20)

The logout behavior was implemented in a reverse manner. The bundle
assumed that Symfony's logout will first call the OpenID logout handling
and then logout the user from Symfony, which is not the case.

The bundle now expects a dedicated logout route (defaulting to
`logout`), which _may_ need adjustments in the implementing application.

Also, the OpenID configuration is now fetched from Keycloak to obtain
the logout URL in order to avoid hard-coded URLs.

Note: since Symfony 6.4, the `LogoutRouteLoader` may be used, allowing
to configure the logout route to `_logout_main` [1].

[1] https://symfony.com/doc/6.4/security.html#logging-out

0 of 22 new or added lines in 5 files covered. (0.0%)

10 of 226 relevant lines covered (4.42%)

9.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/DependencyInjection/Configuration.php
1
<?php
2
declare(strict_types=1);
3

4
/*
5
 * This file is part of the package t3g/symfony-keycloak-bundle.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE file that was distributed with this source code.
9
 */
10

11
namespace T3G\Bundle\Keycloak\DependencyInjection;
12

13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
use T3G\Bundle\Keycloak\Security\KeyCloakUserProvider;
16

17
class Configuration implements ConfigurationInterface
18
{
19
    public function getConfigTreeBuilder(): TreeBuilder
20
    {
21
        $treeBuilder = new TreeBuilder('t3g_keycloak');
×
22
        $treeBuilder->getRootNode()
×
23
            ->children()
×
24
                ->arrayNode('keycloak')->addDefaultsIfNotSet()
×
25
                    ->children()
×
26
                        ->scalarNode('user_provider_class')
×
27
                            ->defaultValue(KeyCloakUserProvider::class)
×
28
                            ->cannotBeEmpty()
×
29
                        ->end()
×
30
                        ->arrayNode('default_roles')
×
31
                            ->defaultValue(['ROLE_USER', 'ROLE_OAUTH_USER'])
×
32
                            ->requiresAtLeastOneElement()
×
33
                            ->scalarPrototype()->end()
×
34
                        ->end()
×
35
                        ->arrayNode('role_mapping')
×
36
                            ->defaultValue([])
×
37
                            ->scalarPrototype()->end()
×
38
                        ->end()
×
39
                        ->scalarNode('clientId')
×
40
                            ->defaultValue('%env(KEYCLOAK_CLIENT_ID)%')
×
41
                            ->cannotBeEmpty()
×
42
                        ->end()
×
43
                    ->end()
×
44
                ->end()
×
45
                ->arrayNode('routes')->addDefaultsIfNotSet()
×
46
                    ->children()
×
47
                        ->scalarNode('authentication')
×
48
                            ->defaultValue('t3g_keycloak_oauthCallback')
×
49
                        ->end()
×
50
                        ->scalarNode('success')
×
51
                            ->defaultValue('home')
×
NEW
52
                        ->end()
×
NEW
53
                        ->scalarNode('logout_route')
×
NEW
54
                            ->defaultValue('logout')
×
55
                        ->end()
×
56
                ->end()
×
57
            ->end()
×
58
        ;
×
59

60
        return $treeBuilder;
×
61
    }
62
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc