Hey again!
I'd like to be able to execute custom logic after authentication succeeds or fails but before the packet is sent to the client: rejecting connections based on authorization rules, logging authentication failure, etc.
Right now, by the time NewCustomizedConn returns, the client has already received the authentication / handshake OK packet, so I can only reject on the first command rather than during the handshake.
What would you think of optional authentication hooks, e.g. OnAuthSuccess and OnAuthFailure?
We could either pass them to NewCustomizedConn, or replace CredentialProvider with a new interface that has a larger scope, e.g. something like AuthenticationHandler.
What do you think? Happy to discuss alternative approaches. :)