mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-23 22:34:50 +03:00
implement RequestAccessTokenEvent
This commit is contained in:
parent
e9271cb7ec
commit
f67a9b7701
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_oauthserver
|
||||||
|
*
|
||||||
|
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||||
|
* @license MIT; see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Event;
|
||||||
|
|
||||||
|
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
|
||||||
|
|
||||||
|
class RequestAccessTokenEvent extends RequestEvent
|
||||||
|
{
|
||||||
|
public function __construct(string $name, array $arguments = [])
|
||||||
|
{
|
||||||
|
if (!array_key_exists('accessToken', $arguments))
|
||||||
|
{
|
||||||
|
throw new \BadMethodCallException("Argument 'accessToken' is required for event $name");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setArgument('accessToken', $arguments['accessToken']);
|
||||||
|
|
||||||
|
parent::__construct($name, $arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function onSetAccessToken(AccessTokenEntityInterface $accessToken): AccessTokenEntityInterface
|
||||||
|
{
|
||||||
|
return $accessToken;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user