You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "chibenwa (via GitHub)" <gi...@apache.org> on 2023/09/25 12:49:03 UTC

[GitHub] [james-project] chibenwa commented on a diff in pull request #1738: JAMES-3942 Audit user trail

chibenwa commented on code in PR #1738:
URL: https://github.com/apache/james-project/pull/1738#discussion_r1335843080


##########
protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java:
##########
@@ -387,6 +389,14 @@ protected Response doAuthTest(SMTPSession session, Username username, String pas
                     } else if (SMTPRetCode.AUTH_OK.equals(res.getRetCode())) {
                         // TODO: Make this string a more useful debug message
                         AUTHENTICATION_DEDICATED_LOGGER.debug("AUTH method {} succeeded", authType);
+
+                        AuditTrail.entry()
+                            .username(username.asString())
+                            .remoteIP(session.getRemoteAddress().getAddress().getHostAddress())
+                            .protocol("SMTP")
+                            .action("AUTH")
+                            .parameters(ImmutableMap.of("authType", authType))
+                            .log("SMTP Authentication succeeded.");

Review Comment:
   Handle the fact that session.getRemoteAddress can be null (if the client disconnects)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org