Very helpful, thanks! As you can see, we’re still happily running on 1.3 but 
incentives for switching to 2.x are about to get the upper hand.

Von: [email protected] <[email protected]> Im 
Auftrag von Peter Stackle
Gesendet: Donnerstag, 13. August 2020 06:45
An: dropwizard-user <[email protected]>
Betreff: Re: Inject ContainerRequestContext / UriInfo into Authorizer

Hi Matthias,
Starting with version 2.0, the Authorizer interface now has the ability to have 
an authorize() method that includes the ContainerRequestContext as a parameter.

https://github.com/dropwizard/dropwizard/blob/master/dropwizard-auth/src/main/java/io/dropwizard/auth/Authorizer.java#L24-L36



On Friday, July 17, 2020 at 12:27:03 AM UTC-7, Matthias Müller wrote:
How can I access ContainerRequestContext / UriInfo from an Authorizer 
implementation?

To not work against Dropwizard, I tried to stick to the usual procedure for 
role-based authentication, e.g.:


final JWTAuthenticationFilter jwtAuthFilter = new 
JWTAuthenticationFilter.Builder()
        .setAuthenticator(new JWTAuthenticator(server, realm))
        .setAuthorizer(new 
ContentAuthorizer(permissionsConfig().accessPermissions()))
        .setPrefix("Bearer")
        .setRealm(realm)
        .buildAuthFilter();


However, my Authorizer implementation (ContentAuthorizer) needs to consider the 
execution context, in particular the path parameters. I found that DW/Jersey do 
inject that Context into Authorizers. So is there a preferred way to do this?


-Matthias






-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dropwizard-user/a1daa452d6bf4c95bd10d47889f61965%40MSX-L104.msx.ad.zih.tu-dresden.de.

Reply via email to