org.glassfish.jersey.server.filter

## Class RolesAllowedDynamicFeature

- java.lang.Object
- - org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature

All Implemented Interfaces:
  jakarta.ws.rs.container.DynamicFeature

    public class RolesAllowedDynamicFeature
    extends Object
    implements jakarta.ws.rs.container.DynamicFeature

A `DynamicFeature` supporting the `jakarta.annotation.security.RolesAllowed`, `jakarta.annotation.security.PermitAll` and `jakarta.annotation.security.DenyAll` on resource methods and sub-resource methods.

The `SecurityContext` is utilized, using the `SecurityContext.isUserInRole(String)` method, to ascertain if the user is in one of the roles declared in by a `&#64;RolesAllowed`. If a user is in none of the declared roles then a 403 (Forbidden) response is returned.

If the `&#64;DenyAll` annotation is declared then a 403 (Forbidden) response is returned.

If the `&#64;PermitAll` annotation is declared and is not overridden then this filter will not be applied.

If a user is not authenticated and annotated method is restricted for certain roles then a 403 (Not Authenticated) response is returned.

Author:
  Paul Sandoz, Martin Matula

### Constructor Summary

Constructors
Constructor and Description
`RolesAllowedDynamicFeature()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `configure(jakarta.ws.rs.container.ResourceInfo resourceInfo, jakarta.ws.rs.core.FeatureContext configuration)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### RolesAllowedDynamicFeature

    public RolesAllowedDynamicFeature()

### Method Detail

#### configure

    public void configure(jakarta.ws.rs.container.ResourceInfo resourceInfo,
                          jakarta.ws.rs.core.FeatureContext configuration)

Specified by:
  `configure` in interface `jakarta.ws.rs.container.DynamicFeature`