It's a common use case and one that's very well suited to the decorator
pattern. I think it's preferable to wrap something in a decorator than
pollute its API with hooks for hypothetical functionality.

On Thu, Mar 2, 2017 at 2:49 PM, <[email protected]> wrote:

> Hi Evan,
>
>      Thanks for the detail reply! I will go ahead and wrap our
> Authenticator and Authorizer. I was hoping there will be callback hooks for
> auth events because I thought implementing things like this for audit trail
> would be a common use case.
>
> On Friday, March 3, 2017 at 5:05:21 AM UTC+11, Evan Meagher wrote:
>>
>> This isn't something that's supported out of the box, but you could
>> easily achieve it in application code. I would argue that in a typical
>> production service, auth{entication,orization}s occur at a rate that
>> wouldn't be practical to log. Thus, Dropwizard hasn't offered the ability
>> to do so.
>>
>> You could create decorators for `Authenticator` and `Authorizer` that
>> intercept invocations of `authenticate` and `authorize` in order to log the
>> credentials, principal, and/or role. Does that make sense?
>>
>> On Wed, Mar 1, 2017 at 10:34 PM, <[email protected]> wrote:
>>
>>> I'm using dropwizard 1.0.6 to set up REST endpoints for my service. Some
>>> of these endpoints are protected by Authenticator (LDAP) and Authorizer
>>> (Role based authorizer) using the method described in the docs (
>>> http://www.dropwizard.io/1.0.6/docs/manual/auth.html).
>>>
>>> What I want to do is I want to issue a log line whenever an authn /
>>> authz event happens. e.g. when authentication succeeded / failed,
>>> authorization succeeded / failed and relevant information like who
>>> authenticated, what was the endpoint, etc. However, I can't find an easy
>>> way to do this after searching through this group and on the internet,
>>> anyone have an idea? Thanks in advance.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "dropwizard-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Evan Meagher
>>
> --
> You received this message because you are subscribed to the Google Groups
> "dropwizard-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Evan Meagher

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to