mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-02-03 17:29:40 +05:30
Updated domain events
This commit is contained in:
parent
3aa15a22af
commit
8a9b3b661d
@ -10,34 +10,38 @@ During the lifecycle of a request passing through the authorization server a num
|
|||||||
|
|
||||||
You can subscribe to these events by attaching listeners to the authorization server.
|
You can subscribe to these events by attaching listeners to the authorization server.
|
||||||
|
|
||||||
## error.auth.client
|
To access the emitter call this method:
|
||||||
|
|
||||||
~~~ php
|
{% highlight php %}
|
||||||
$server->addEventListener('error.auth.client', function ($event) { });
|
$server->getEmitter(); // returns instance of \League\Event\EmitterInterface
|
||||||
~~~
|
{% endhighlight %}
|
||||||
|
|
||||||
|
## client.authentication.failed
|
||||||
|
|
||||||
|
{% highlight php %}
|
||||||
|
$server->getEmitter()->addListener(
|
||||||
|
'client.authentication.failed',
|
||||||
|
function (\League\OAuth2\Server\RequestEvent $event) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
);
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
This event is emitted when a client fails to authenticate. You might wish to listen to this event in order to ban clients that fail to authenticate after `n` number of attempts.
|
This event is emitted when a client fails to authenticate. You might wish to listen to this event in order to ban clients that fail to authenticate after `n` number of attempts.
|
||||||
|
|
||||||
You can retrieve the request object that was used by calling `getRequest()` on the event object passed into your callable.
|
You can retrieve the request object that was used by calling `getRequest()` on the event object passed into your callable.
|
||||||
|
|
||||||
## error.auth.user
|
## user.authentication.failed
|
||||||
|
|
||||||
~~~ php
|
{% highlight php %}
|
||||||
$server->addEventListener('error.auth.user', function ($event) { });
|
$server->getEmitter()->addListener(
|
||||||
~~~
|
'user.authentication.failed',
|
||||||
|
function (\League\OAuth2\Server\RequestEvent $event) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
);
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
This event is emitted when a user fails to authenticate. You might wish to listen to this event in order to reset passwords or ban users that fail to authenticate after `n` number of attempts.
|
This event is emitted when a user fails to authenticate. You might wish to listen to this event in order to reset passwords or ban users that fail to authenticate after `n` number of attempts.
|
||||||
|
|
||||||
You can retrieve the request object that was used by calling `getRequest()` on the event object passed into your callable.
|
You can retrieve the request object that was used by calling `getRequest()` on the event object passed into your callable.
|
||||||
|
|
||||||
## session.owner
|
|
||||||
|
|
||||||
~~~ php
|
|
||||||
$server->addEventListener('session.owner', function ($event) { });
|
|
||||||
~~~
|
|
||||||
|
|
||||||
This event is emitted when a session has been allocated an owner (for example a user or a client).
|
|
||||||
|
|
||||||
You might want to use this event to dynamically associate scopes to the session depending on the users role or ACL permissions.
|
|
||||||
|
|
||||||
You can access the session entity objected by calling `getSession()` on the event object passed into your callable.
|
|
Loading…
x
Reference in New Issue
Block a user