• 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/Service/OpenIdService.php
1
<?php
2

3
declare(strict_types=1);
4

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

12
namespace T3G\Bundle\Keycloak\Service;
13

14
use GuzzleHttp\Client;
15
use Symfony\Component\Cache\Adapter\ArrayAdapter;
16
use Symfony\Component\Cache\Adapter\ChainAdapter;
17
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
18
use Symfony\Contracts\Cache\ItemInterface;
19

20
class OpenIdService
21
{
22
    public function getOpenIdConfiguration(string $realmUrl)
23
    {
NEW
24
        $cacheChain = new ChainAdapter([
×
NEW
25
            new ArrayAdapter(),
×
NEW
26
            new FilesystemAdapter(),
×
NEW
27
        ]);
×
28

NEW
29
        return $cacheChain->get('keycloak-openid-' . hash('xxh3', $realmUrl), function (ItemInterface $item) use ($realmUrl) {
×
NEW
30
            $item->expiresAfter(3600);
×
31

NEW
32
            $client = new Client();
×
NEW
33
            $response = $client->request('GET', $realmUrl . '/.well-known/openid-configuration');
×
34

NEW
35
            return json_decode((string)$response->getBody(), true, 512, JSON_THROW_ON_ERROR);
×
NEW
36
        });
×
37
    }
38
}
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

© 2026 Coveralls, Inc