Skip to content

Authentication hooks for post-authentication logic before OK packet #1071

@ramnes

Description

@ramnes

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. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions