-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #129 Fix Symfony 6.2 deprecation for Security helper (RobertMe)
This PR was merged into the 0.4-dev branch. Discussion ---------- Fix Symfony 6.2 deprecation for Security helper As the title states :) In Symfony 6.2 the Security helper of the Security component has been marked as deprecated, with a replacement helper being added in the Security bundle. This change fixes the deprecation by referencing the service by the name (`security.helper`) instead of the FQN, and for the "user" two implementations are added, one depending on the old class and one depending on the new class. Tested on PHP 7.2 and 8.1 using both high and low dependencies. Commits ------- 04329d0 Fix Symfony 6.2 deprecation for Security helper
- Loading branch information
Showing
3 changed files
with
50 additions
and
21 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
17 changes: 17 additions & 0 deletions
17
src/EventListener/AuthorizationRequestUserResolvingListenerTrait.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,17 @@ | ||
<?php | ||
|
||
namespace League\Bundle\OAuth2ServerBundle\EventListener; | ||
|
||
use League\Bundle\OAuth2ServerBundle\Event\AuthorizationRequestResolveEvent; | ||
use Symfony\Component\Security\Core\User\UserInterface; | ||
|
||
trait AuthorizationRequestUserResolvingListenerTrait | ||
{ | ||
public function onAuthorizationRequest(AuthorizationRequestResolveEvent $event): void | ||
{ | ||
$user = $this->security->getUser(); | ||
if ($user instanceof UserInterface) { | ||
$event->setUser($user); | ||
} | ||
} | ||
} |
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