Intercept and log ban rejections on connection?Solved
I'm attempting to intercept the connection attempt and subsequent rejection messages a user receives when banned. For example, as seen in console when the player is rejected:
12.345.67.890:12345/steamID/Username Rejecting connection - You are banned from this server (reason text)

I assumed the CanUserLogin hook would capture and/or control this rejection, but after testing, it is apparent that it does not fire at all on said event. I had written the following segment in an attempt to intercept and relay the rejection to a log file (some irrelevant bits have been omitted) but was not successful:

bool IsPlayerBannedFromServer(ulong steamID)
{
    ServerUsers.User user = ServerUsers.Get(steamID);
    return user != null && user.group == ServerUsers.UserGroup.Banned;
}
object CanUserLogin(string _player_name, string _player_id, string _player_ip)
{
    ulong convertedSteamID = Convert.ToUInt64(_player_id);
    
    if (IsPlayerBannedFromServer(convertedSteamID)) 
    {
        ServerUsers.User banned = ServerUsers.Get(convertedSteamID);
        string _player_reason = banned.notes;

        // Connection Rejected
        var dict = new Dictionary<string, string>
        {
            { "playername", _player_name },
            { "playerip",  _player_ip },
            { "playersteamid", _player_id },
            { "playerreason", _player_reason }
        };
        // Do some stuff with the info
        
    }
    return null;
}​

Anyone willing to help write a quick plugin that will do this? or better yet, guide me in the right direction as to which hook can see these rejections?

Thank you for your time and consideration. I really appreciate it.

Maybe not sure if this can help you at all but this hook is getting fired on connection.
void OnClientAuth(Connection connection)
{
    Puts("OnClientAuth works!");
}​
private void OnClientAuth(Connection connection)
        {
            var id = connection.userid;
            var user = ServerUsers.Get(id);
            if (user != null && user.@group == ServerUsers.UserGroup.Banned)
            {
                var message = $"{user.username}[{user.steamid}] tried to connect server ({user.notes})";
                LogToFile("blocked", message, this);
                Puts(message);
            }
        }
OnClientAuth was indeed the correct hook. Got everything working perfectly! Thank you @sami37 and @Orange for pointing me in the right direction. I really appreciate both of you.
Locked automatically