Abstract emmit listeners register

This commit is contained in:
Artem Vasilev 2024-03-13 03:36:00 +03:00
parent b584ecbcbf
commit 96db629ab7

View File

@ -25,6 +25,7 @@ use League\OAuth2\Server\Grant\AuthCodeGrant;
use League\OAuth2\Server\Grant\ClientCredentialsGrant; use League\OAuth2\Server\Grant\ClientCredentialsGrant;
use League\OAuth2\Server\Grant\ImplicitGrant; use League\OAuth2\Server\Grant\ImplicitGrant;
use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Grant\RefreshTokenGrant;
use League\OAuth2\Server\RequestEvent;
use Webmasterskaya\Component\OauthServer\Administrator\Model\AccessTokenModel; use Webmasterskaya\Component\OauthServer\Administrator\Model\AccessTokenModel;
use Webmasterskaya\Component\OauthServer\Administrator\Model\AuthCodeModel; use Webmasterskaya\Component\OauthServer\Administrator\Model\AuthCodeModel;
use Webmasterskaya\Component\OauthServer\Administrator\Model\ClientModel; use Webmasterskaya\Component\OauthServer\Administrator\Model\ClientModel;
@ -159,6 +160,34 @@ class LoginController extends BaseController
); );
} }
$server->getEmitter()
->addListener(
RequestEvent::USER_AUTHENTICATION_FAILED,
function (RequestEvent $event) {
// TODO:: Dispatch event with Joomla EventDispatcher by name `onUserAuthenticationFailed`
}
)->addListener(
RequestEvent::CLIENT_AUTHENTICATION_FAILED,
function (RequestEvent $event) {
// TODO:: Dispatch event with Joomla EventDispatcher by name `onClientAuthenticationFailed`
}
)->addListener(
RequestEvent::REFRESH_TOKEN_CLIENT_FAILED,
function (RequestEvent $event) {
// TODO:: Dispatch event with Joomla EventDispatcher by name `onRefreshTokenClientFailed`
}
)->addListener(
RequestEvent::REFRESH_TOKEN_ISSUED,
function (RequestEvent $event) {
// TODO:: Dispatch event with Joomla EventDispatcher by name `onRefreshTokenIssued`
}
)->addListener(
RequestEvent::ACCESS_TOKEN_ISSUED,
function (RequestEvent $event) {
// TODO:: Dispatch event with Joomla EventDispatcher by name `onAccessTokenIssued`
}
);
$this->authorizationServer = $server; $this->authorizationServer = $server;
} }