Annotation Type ProtectedApi


@NameBinding @Retention(RUNTIME) @Target({TYPE,METHOD}) public @interface ProtectedApi
Annotate a JAX-RS resource method with this annotation to make the endpoint protected. Clients hitting your endpoint must pass a valid OAuth bearer token (with proper scopes) in the request header to have access. Example:

 import jakarta.ws.rs.GET;
 import jakarta.ws.rs.Path;

 @Path("/library")
 public class LibraryRestService {

    @GET
    @Path("/books")
    @ProtectedApi(scopes = {"read"})
    public String getBooks() {
        return ...
    }

 }
 
If all methods of your class are protected using the same scopes, apply the annotation at the class level instead
Author:
jgomer
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
  • Element Details

    • scopes

      String[] scopes
      Default:
      {}