-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [TASK] Symfony 6 Upgrade * Move to KNPU bundle * Update README.md * Update composer dependencies * Fix group evaluation * Drop Symfony 4 & 5 and PHP 7.4 support, fix cgl * Add Symfony 5 again, update CI * Add dependency * Provide configuration options for routes * Provide default login/logout actions and move logic into a service class * Update dependencies and fix CGL * Fix DI in Symfony 5 * Fix Symfony 5 issues * Fix CGL * Code cleanup and comparison fix
- Loading branch information
Showing
17 changed files
with
415 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the package t3g/symfony-keycloak-bundle. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace T3G\Bundle\Keycloak\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use T3G\Bundle\Keycloak\Service\RedirectService; | ||
|
||
class LoginController extends AbstractController | ||
{ | ||
private RedirectService $redirectService; | ||
|
||
public function __construct(RedirectService $redirectService) | ||
{ | ||
$this->redirectService = $redirectService; | ||
} | ||
|
||
public function login(): RedirectResponse | ||
{ | ||
if (null !== $this->getUser()) { | ||
return $this->redirectToRoute($this->getParameter('t3g_keycloak.routes.success')); | ||
} | ||
|
||
return $this->redirectService->generateLoginRedirectResponse(['openid', 'profile', 'roles', 'email']); | ||
} | ||
|
||
public function oauthCallback(): RedirectResponse | ||
{ | ||
// fallback in case the authenticator does not redirect | ||
return $this->redirectToRoute($this->getParameter('t3g_keycloak.routes.success')); | ||
} | ||
|
||
public function oauthLogout(): RedirectResponse | ||
{ | ||
return $this->redirectService->generateLogoutRedirectResponse(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.