public class AuthDynamicFeature extends Object implements javax.ws.rs.container.DynamicFeature
DynamicFeature
that registers the provided auth filter
to resource methods annotated with the RolesAllowed
, PermitAll
and DenyAll
annotations.
In conjunction with RolesAllowedDynamicFeature
it enables
authorization AND authentication of requests on the annotated methods.
If authorization is not a concern, then RolesAllowedDynamicFeature
could be omitted. But to enable authentication, the PermitAll
annotation
should be placed on the corresponding resource methods.
Note that registration of the filter will follow the semantics of
Configurable.register(Class)
and Configurable.register(Object)
:
passing the filter as a Class
to the AuthDynamicFeature(Class)
constructor will result in dependency injection, while objects passed to
the AuthDynamicFeature(ContainerRequestFilter)
will be used directly.
Constructor and Description |
---|
AuthDynamicFeature(Class<? extends javax.ws.rs.container.ContainerRequestFilter> authFilterClass) |
AuthDynamicFeature(javax.ws.rs.container.ContainerRequestFilter authFilter) |
Modifier and Type | Method and Description |
---|---|
void |
configure(javax.ws.rs.container.ResourceInfo resourceInfo,
javax.ws.rs.core.FeatureContext context) |
public AuthDynamicFeature(javax.ws.rs.container.ContainerRequestFilter authFilter)
public AuthDynamicFeature(Class<? extends javax.ws.rs.container.ContainerRequestFilter> authFilterClass)
Copyright © 2019. All rights reserved.