tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Request for comment on BZ 59750 (authentication listener)
Date Thu, 29 Mar 2018 18:07:47 GMT

On 3/29/18 11:41 AM, Rémy Maucherat wrote:
> On Thu, Mar 29, 2018 at 3:48 PM, Christopher Schultz <
>> wrote:
>> All,
>> For reference:
>> I've got a proposal (in patch form) attached to that BZ issue.
>> Ralf's enhancement request is fairly terse, but this is something I'd
>> like to have as well.
>> The requirement is to be able to log failed authentication attempts. As
>> it stands, using container-managed authentication does not allow this
>> (as far as I can tell).
>> My proposal is essentially a new listener interface that authenticator
>> classes will invoke (if registered) when an authentication event occurs
>> (success or failure). The Request object and username are currently
>> arguments to the two methods on the interface.
>> You can read the entire current path without even scrolling your screen.
>> Before attempting to publish a more complete patch, I wanted to know if
>> there was any appetite for this kind of thing, or any objections.
> Ok with the idea, but the patch is indeed very incomplete.

Absolutely. I wanted to make sure there were no -1s before I spent much
time on it. That represents maybe 5 minutes of work :)

Some specific questions:

For FormAuthenticator: there are several calls to authenticate() in
doAuthenticate. I chose to ignore the call at the top of the method
because I didn't understand the purpose. Something about
re-authentication of a previous-authentication? Would it be appropriate
to also fire an authentication event at that time?

For Basic/DigestAuthenticator: since technically the user is being
authenticated at *every* request, should we bother trying to avoid
spamming the Listener, or should we let the Listener decide how to
handle the huge number of events it will likely get? Does Tomcat know
whether the authentication is a re-authentication or not? If so, should
it let the Listener know this is a re-authentication?

Implementing a listener in a webapp: can a listener be registered from
within the web application without any ClassLoader weirdness? What
options exist for writing a listener that doesn't require a compile-time
dependency on Tomcat? (I suspect this is unavoidable, because even if
reflection is used to invoke the listener's method by *name* and not via
an interface-call, the Tomcat-specific Request class is a parameter to
the interface methods. Changing that to "Object" kind of defeats the
purpose of the interface.)


View raw message