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/2442eccc-6ad4-42c0-bd83-3ed5e637bf9eo%40googlegroups.com.
