Class TestTaskAuthorizationProvider_v0_3

java.lang.Object
org.a2aproject.sdk.compat03.conversion.test.TestTaskAuthorizationProvider_v0_3
All Implemented Interfaces:
TaskAuthorizationProvider

@ApplicationScoped public class TestTaskAuthorizationProvider_v0_3 extends Object implements TaskAuthorizationProvider
  • Constructor Details

    • TestTaskAuthorizationProvider_v0_3

      public TestTaskAuthorizationProvider_v0_3()
  • Method Details

    • checkRead

      public boolean checkRead(ServerCallContext context, String taskId, TaskOperation operation)
      Description copied from interface: TaskAuthorizationProvider
      Check whether the current user is allowed to read the given task.

      For TaskOperation.LIST_TASKS, taskId is an empty-string sentinel representing the whole list scope: the decorator calls this method once before delegation (deny rejects the entire list), and the TaskStore subsequently calls it per task during list() filtering. Providers should treat "" with LIST_TASKS as "may this user list tasks at all" — returning false hides all tasks.

      Specified by:
      checkRead in interface TaskAuthorizationProvider
      Parameters:
      context - the server call context containing the authenticated user
      taskId - the task being accessed, or "" for the list scope of LIST_TASKS
      operation - which RequestHandler method triggered the check
      Returns:
      true to allow, false to deny
    • checkWrite

      public boolean checkWrite(ServerCallContext context, String taskId, TaskOperation operation)
      Description copied from interface: TaskAuthorizationProvider
      Check whether the current user is allowed to write to the given task.
      Specified by:
      checkWrite in interface TaskAuthorizationProvider
      Parameters:
      context - the server call context containing the authenticated user
      taskId - the task being accessed
      operation - which RequestHandler method triggered the check
      Returns:
      true to allow, false to deny
    • checkCreate

      public boolean checkCreate(ServerCallContext context, TaskOperation operation)
      Description copied from interface: TaskAuthorizationProvider
      Check whether the current user is allowed to create a new task.
      Specified by:
      checkCreate in interface TaskAuthorizationProvider
      Parameters:
      context - the server call context containing the authenticated user
      operation - which RequestHandler method triggered the check
      Returns:
      true to allow, false to deny
    • isTaskRecorded

      public boolean isTaskRecorded(String taskId)
      Description copied from interface: TaskAuthorizationProvider
      Check whether the given task is already known to this provider. Used to avoid redundant TaskAuthorizationProvider.recordOwnership(ServerCallContext, String, TaskOperation) calls.
      Specified by:
      isTaskRecorded in interface TaskAuthorizationProvider
      Parameters:
      taskId - the task to check
      Returns:
      true if ownership has already been recorded for this task
    • recordOwnership

      public void recordOwnership(ServerCallContext context, String taskId, TaskOperation operation)
      Description copied from interface: TaskAuthorizationProvider
      Record that the current user owns the given task. Called after task creation via onMessageSend or onMessageSendStream.

      Must be idempotent. Concurrent requests for the same unrecorded task may both call this method before either completes.

      Specified by:
      recordOwnership in interface TaskAuthorizationProvider
      Parameters:
      context - the server call context containing the authenticated user
      taskId - the newly created task
      operation - which RequestHandler method triggered the recording