Interface Authorizer<P extends Principal>

Type Parameters:
P - the type of principals
All Known Implementing Classes:
CachingAuthorizer, PermitAllAuthorizer

public interface Authorizer<P extends Principal>
An interface for classes which authorize principal objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    authorize(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)
    Decides if access is granted for the given principal in the given role.
    getAuthorizationContext(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)
    Returns an AuthorizationContext object, to be used in CachingAuthorizer as cache key.
  • Method Details

    • authorize

      boolean authorize(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)
      Decides if access is granted for the given principal in the given role.
      Parameters:
      principal - a Principal object, representing a user
      role - a user role
      requestContext - a request context.
      Returns:
      true, if the access is granted, false otherwise
      Since:
      2.0
    • getAuthorizationContext

      default AuthorizationContext<P> getAuthorizationContext(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)
      Returns an AuthorizationContext object, to be used in CachingAuthorizer as cache key.
      Parameters:
      principal - a Principal object, representing a user
      role - a user role
      requestContext - a request context.
      Returns:
      AuthorizationContext object, to be used in CachingAuthorizer.
      Since:
      2.1