You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If fifth attempt, block IP address for a couple of minutes, to cool it down.
280
+
});
281
+
```
282
+
283
+
As you can see from the example above, you can provide multiple handlers for the same event. Following events are available:
284
+
285
+
1.`onUserAuthenticated` - (visit) User is recognized by its session cookie, token etc, so it was authenticated. Arguments provided to the callaback are user instance [AuthenticatedUserInterface], and authentication result [AuthenticationResultInterface].
286
+
1.`onUserAuthorized` (login) User provided valid credentials, and system authorized it. Arguments provided to the callaback are user instance [AuthenticatedUserInterface], and authentication result [AuthenticationResultInterface].
287
+
1.`onUserAuthorizationFailed` (login failed) User tried to authorize, but provided credentials were not valid, or authorization failed due to other reasons (SSO service down, etc). Arguments provided to the callback are user's credentials [array], as well as the failure reason ([Exception] or [Throwable]).
288
+
1.`onUserSet` - User is set - authenticated, authorizer, or app set the user using its own logic. Argument provided to the callback is the user instance [AuthenticatedUserInterface].
289
+
1.`setOnUserDeauthenticated` (logout) User logged out. Argument provided to the callback is authentication method that got terminated [AuthenticationResultInterface].
290
+
258
291
## Authentication Middlewares
259
292
260
293
`AuthenticationInterface` interface assumes that implementation will be such that it can be invoked as a middleware in a [PSR-7](http://www.php-fig.org/psr/psr-7/) middleware stack. That is why implementation of `__invoke` method in middleware stack fashion is part of the interface.
@@ -446,5 +479,5 @@ Login policy implements `\JsonSerializable` interface, and can be safely encoded
446
479
447
480
## To Do
448
481
449
-
1. Consider adding previously used passwords repository, so library can enforce no-repeat policy for passwords,
450
-
1.Add `onAuthentication()`, `onAuthorization()`, `onDeauthentication()` events to `AuthenticationInterface`.
482
+
1. Consider adding previously used passwords repository, so library can enforce no-repeat policy for passwords.
0 commit comments