Have Passport Emit an Event on Authentication Failure

My motivation for this is a use case we have in using Passport: we want to use it to respond automatically with a 401 on authentication failure, but we also want to be notified of authentication failures, e.g., for logging or for being able to detect attacks (brute force or DOS). I couldn't find any way to do this without registering a custom callback, which would mean, basically, handling the error ourselves, which is what we want Passport for.

I understand that this means making Passport an EventEmitter, which might be considered an intrusive change. If there's a different way of accomplishing the same objective, that would be fine; I just need some notification mechanism.