-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* IBX-8140: Enabled authenticator manager-based security * adjusted tests after removing obsolete services * added proper access denied listener grouping all access issues and redirecting to the login form * [TMP][Behat] Added @javascript to failed scenarios to see screenshots * fixed phpstan * renamed AccessDeniedListener to *Subscriber and made it more loose when detecting permission issues * [TMP] Added dependencies.json * [TMP] Dropped core self-reference from dependencies.json * regenerated phpstan baseline * cr remarks * adjusted unit tests * removed unused methods due to SecurityPass changes * reverted decorating `DefaultAuthenticationSuccessHandler` * cr remarks * dropped @javascript due to performance reasons * removed dependencies.json --------- Co-authored-by: Andrew Longosz <[email protected]>
- Loading branch information
1 parent
1ed6afa
commit eeb08b4
Showing
19 changed files
with
149 additions
and
1,233 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
23 changes: 0 additions & 23 deletions
23
src/bundle/Core/DependencyInjection/Security/HttpBasicFactory.php
This file was deleted.
Oops, something went wrong.
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
Empty file.
41 changes: 0 additions & 41 deletions
41
src/lib/MVC/Symfony/Security/Authentication/AnonymousAuthenticationProvider.php
This file was deleted.
Oops, something went wrong.
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
46 changes: 46 additions & 0 deletions
46
src/lib/MVC/Symfony/Security/Authentication/EventSubscriber/AccessDeniedSubscriber.php
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,46 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Core\MVC\Symfony\Security\Authentication\EventSubscriber; | ||
|
||
use Ibexa\Contracts\Core\Repository\Exceptions\Exception as IbexaRepositoryException; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use Symfony\Component\HttpKernel\Event\ExceptionEvent; | ||
use Symfony\Component\HttpKernel\KernelEvents; | ||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | ||
|
||
final readonly class AccessDeniedSubscriber implements EventSubscriberInterface | ||
{ | ||
public function __construct(private UrlGeneratorInterface $urlGenerator) | ||
{ | ||
} | ||
|
||
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
// the priority must be greater than the Security HTTP | ||
// ExceptionListener, to make sure it's called before | ||
// the default exception listener | ||
KernelEvents::EXCEPTION => ['onKernelException', 2], | ||
]; | ||
} | ||
|
||
public function onKernelException(ExceptionEvent $event): void | ||
{ | ||
$exception = $event->getThrowable()->getPrevious(); | ||
|
||
if ($exception instanceof IbexaRepositoryException) { | ||
return; | ||
} | ||
|
||
$event->setResponse(new RedirectResponse( | ||
$this->urlGenerator->generate('login') | ||
)); | ||
} | ||
} |
Oops, something went wrong.