I am trying to extend the Zimbra authentication to incorporate our custom Authentication Logic. To do so I was able to successfully create a server extension by extending the ZimbraCustomAuth class. I placed the jar in /lib/ext<my extension> folder, and it was called and executed just fine. Now, for my custom logic, the original client IP address is of utmost importance. From what I could gather, the authenticate method in this class has a "context" object:
public void authenticate(Account acct, String password, Map<String, Object> context, List<String> args) throws Exception
Within this context object there is a value for "Original client IP address", which can be retrieved as:
Now, this works fine for POP and IMAP. I get the calling clients IP address in ocip field. The trouble is with SMTP and SOAP. In case of SOAP, the ocip value is always the Zimbra's server's local IP and in case of smtp it is null.
Could someone please explain why this is so? Is it by design? Is it a bug? Has someone else faced this issue?
The IP is very critical for my implementation so if someone could suggest a way of extracting the correct originating IP in custom authentication, it would be hugely appreciated.