Hi John,

when using the authentication mechanisms provided by Jersey and Dropwizard 
Authentication, you can use the regular @PermitAll and @RolesAllowed 
annotations on JAX-RS resource classes and resource methods.

https://www.dropwizard.io/en/release-2.0.x/manual/auth.html#protecting-resources
 
<https://www.dropwizard.io/en/release-2.0.x/manual/auth.html#protecting-resources>

Cheers,
Jochen

> Am 09.09.2021 um 18:58 schrieb John Bedalov <[email protected]>:
> 
> We have a requirement to have a mix of open and auth'ed APIs. Is there a 
> configuration technique to do so using dropwizard-auth?
> 
> I have something working by adding my own AuthFilter that then defers to 
> BasicAuthFilter if the path is one that I need to auth. Like this
> 
> BasicCredentialAuthFilter<PrincipalImpl> basicAuthFilter = new 
> Builder<PrincipalImpl>()
> .buildAuthFilter();
> 
> return new AuthFilter<>()
> {
> @Override
> public void filter(ContainerRequestContext requestContext) throws IOException 
> {
> if (((ContainerRequest) requestContext).getPath(true).equals("foo")) {
> basicAuthFilter.filter(requestContext);
> }
> }
> };
> 
> Thanks for any info!
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/dropwizard-user/8b64d221-d54e-4016-b8ce-0f0395513723n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/dropwizard-user/8b64d221-d54e-4016-b8ce-0f0395513723n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/387CB7A2-0AD8-453E-8689-5284E6FF5FC1%40schalanda.name.

Reply via email to