From fb325ea06f623dae4f180f4b00366f03511c7ae4 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Thu, 14 Mar 2024 16:41:14 +0300 Subject: [PATCH] implement RequestRefreshTokenEvent --- .../src/Event/RequestRefreshTokenEvent.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 com_oauthserver/administrator/src/Event/RequestRefreshTokenEvent.php diff --git a/com_oauthserver/administrator/src/Event/RequestRefreshTokenEvent.php b/com_oauthserver/administrator/src/Event/RequestRefreshTokenEvent.php new file mode 100644 index 0000000..558785d --- /dev/null +++ b/com_oauthserver/administrator/src/Event/RequestRefreshTokenEvent.php @@ -0,0 +1,33 @@ + + * @license MIT; see LICENSE.txt + **/ + +namespace Webmasterskaya\Component\OauthServer\Administrator\Event; + +use League\OAuth2\Server\Entities\RefreshTokenEntityInterface; + +class RequestRefreshTokenEvent extends AbstractImmutableEvent +{ + public function __construct(string $name, array $arguments = []) + { + if (!array_key_exists('refreshToken', $arguments)) + { + throw new \BadMethodCallException("Argument 'refreshToken' is required for event $name"); + } + + $this->setArgument('refreshToken', $arguments['refreshToken']); + + parent::__construct($name, $arguments); + } + + protected function onSetRefreshToken(RefreshTokenEntityInterface $refreshToken): RefreshTokenEntityInterface + { + return $refreshToken; + } + +}