mohiva/play-silhouette — pull request #59 by akkie (2014-05-18 20:04:08+00:00)
Title: Publish events

Publish relevant events that can be consumed by the application in a [publish-subscribe pattern](http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern).

These events are not meant for customization of the authentication and authorization logic. The library's extension points are meant for that, via method overriding and dependency injection.

They're meant for loosely-coupled, system-wide integration, in the spirit of [The Reactive Manifesto](http://www.reactivemanifesto.org/#event-driven).

These events will broadcast the occurrence of significant facts related to authentication and authorization, such as:

* A new user was created.
* A user logged in.
* A user logged out.
* A user attempted to log in with invalid credentials.
* A user attempted to reuse a consumed token.
* A request passed authentication.
* A request did not pass authentication.
* A request did not pass authorization.

Application (or contrib) code can listen to some of these events and take action such as logging, notification, metrics, etc.

We should consider using Akka for this task. Maybe we can use the event bus implementation from Akka:

* http://stackoverflow.com/a/14892971/2153190
* http://doc.akka.io/docs/akka/2.1-M2/scala/event-bus.html