mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-23 22:34:50 +03:00
Provide all League event listeners
This commit is contained in:
parent
fb325ea06f
commit
cc21c03f37
@ -25,7 +25,10 @@ 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 League\OAuth2\Server\RequestEvent as LeagueRequestEvent;
|
||||||
|
use Webmasterskaya\Component\OauthServer\Administrator\Event\RequestAccessTokenEvent;
|
||||||
|
use Webmasterskaya\Component\OauthServer\Administrator\Event\RequestEvent;
|
||||||
|
use Webmasterskaya\Component\OauthServer\Administrator\Event\RequestRefreshTokenEvent;
|
||||||
use Webmasterskaya\Component\OauthServer\Administrator\Event\TokenRequestResolveEvent;
|
use Webmasterskaya\Component\OauthServer\Administrator\Event\TokenRequestResolveEvent;
|
||||||
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;
|
||||||
@ -163,29 +166,57 @@ class LoginController extends BaseController
|
|||||||
|
|
||||||
$server->getEmitter()
|
$server->getEmitter()
|
||||||
->addListener(
|
->addListener(
|
||||||
RequestEvent::USER_AUTHENTICATION_FAILED,
|
LeagueRequestEvent::USER_AUTHENTICATION_FAILED,
|
||||||
function (RequestEvent $event) {
|
function (LeagueRequestEvent $event) {
|
||||||
// TODO:: Dispatch event with Joomla EventDispatcher by name `onUserAuthenticationFailed`
|
$name = 'onUserAuthenticationFailed';
|
||||||
|
$this->getDispatcher()->dispatch($name, new RequestEvent(
|
||||||
|
$name,
|
||||||
|
['request' => $event->getRequest()]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
)->addListener(
|
)->addListener(
|
||||||
RequestEvent::CLIENT_AUTHENTICATION_FAILED,
|
LeagueRequestEvent::CLIENT_AUTHENTICATION_FAILED,
|
||||||
function (RequestEvent $event) {
|
function (LeagueRequestEvent $event) {
|
||||||
// TODO:: Dispatch event with Joomla EventDispatcher by name `onClientAuthenticationFailed`
|
$name = 'onClientAuthenticationFailed';
|
||||||
|
$this->getDispatcher()->dispatch($name, new RequestEvent(
|
||||||
|
$name,
|
||||||
|
['request' => $event->getRequest()]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
)->addListener(
|
)->addListener(
|
||||||
RequestEvent::REFRESH_TOKEN_CLIENT_FAILED,
|
LeagueRequestEvent::REFRESH_TOKEN_CLIENT_FAILED,
|
||||||
function (RequestEvent $event) {
|
function (LeagueRequestEvent $event) {
|
||||||
// TODO:: Dispatch event with Joomla EventDispatcher by name `onRefreshTokenClientFailed`
|
$name = 'onRefreshTokenClientFailed';
|
||||||
|
$this->getDispatcher()->dispatch($name, new RequestEvent(
|
||||||
|
$name,
|
||||||
|
['request' => $event->getRequest()]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
)->addListener(
|
)->addListener(
|
||||||
RequestEvent::REFRESH_TOKEN_ISSUED,
|
LeagueRequestEvent::REFRESH_TOKEN_ISSUED,
|
||||||
function (RequestEvent $event) {
|
function (LeagueRequestEvent $event) {
|
||||||
// TODO:: Dispatch event with Joomla EventDispatcher by name `onRefreshTokenIssued`
|
/** @var \League\OAuth2\Server\RequestRefreshTokenEvent $event */
|
||||||
|
$name = 'onRefreshTokenIssued';
|
||||||
|
$this->getDispatcher()->dispatch($name, new RequestRefreshTokenEvent(
|
||||||
|
$name,
|
||||||
|
[
|
||||||
|
'request' => $event->getRequest(),
|
||||||
|
'refreshToken' => $event->getRefreshToken()
|
||||||
|
]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
)->addListener(
|
)->addListener(
|
||||||
RequestEvent::ACCESS_TOKEN_ISSUED,
|
LeagueRequestEvent::ACCESS_TOKEN_ISSUED,
|
||||||
function (RequestEvent $event) {
|
function (LeagueRequestEvent $event) {
|
||||||
// TODO:: Dispatch event with Joomla EventDispatcher by name `onAccessTokenIssued`
|
/** @var \League\OAuth2\Server\RequestAccessTokenEvent $event */
|
||||||
|
$name = 'onAccessTokenIssued';
|
||||||
|
$this->getDispatcher()->dispatch($name, new RequestAccessTokenEvent(
|
||||||
|
$name,
|
||||||
|
[
|
||||||
|
'request' => $event->getRequest(),
|
||||||
|
'accessToken' => $event->getAccessToken()
|
||||||
|
]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user