Class AuthDynamicFeature

  • All Implemented Interfaces:
    javax.ws.rs.container.DynamicFeature, javax.ws.rs.core.Feature

    public class AuthDynamicFeature
    extends Object
    implements javax.ws.rs.core.Feature, javax.ws.rs.container.DynamicFeature
    A 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.

    • Constructor Detail

      • AuthDynamicFeature

        public AuthDynamicFeature​(javax.ws.rs.container.ContainerRequestFilter authFilter)
      • AuthDynamicFeature

        public AuthDynamicFeature​(Class<? extends javax.ws.rs.container.ContainerRequestFilter> authFilterClass)
    • Method Detail

      • configure

        public void configure​(javax.ws.rs.container.ResourceInfo resourceInfo,
                              javax.ws.rs.core.FeatureContext context)
        Specified by:
        configure in interface javax.ws.rs.container.DynamicFeature
      • configure

        public boolean configure​(javax.ws.rs.core.FeatureContext context)
        Specified by:
        configure in interface javax.ws.rs.core.Feature