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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckCreate(ServerCallContext context, TaskOperation operation) Check whether the current user is allowed to create a new task.booleancheckRead(ServerCallContext context, String taskId, TaskOperation operation) Check whether the current user is allowed to read the given task.booleancheckWrite(ServerCallContext context, String taskId, TaskOperation operation) Check whether the current user is allowed to write to the given task.booleanisTaskRecorded(String taskId) Check whether the given task is already known to this provider.voidrecordOwnership(ServerCallContext context, String taskId, TaskOperation operation) Record that the current user owns the given task.
-
Constructor Details
-
TestTaskAuthorizationProvider_v0_3
public TestTaskAuthorizationProvider_v0_3()
-
-
Method Details
-
checkRead
Description copied from interface:TaskAuthorizationProviderCheck whether the current user is allowed to read the given task.For
TaskOperation.LIST_TASKS,taskIdis an empty-string sentinel representing the whole list scope: the decorator calls this method once before delegation (deny rejects the entire list), and theTaskStoresubsequently calls it per task duringlist()filtering. Providers should treat""withLIST_TASKSas "may this user list tasks at all" — returningfalsehides all tasks.- Specified by:
checkReadin interfaceTaskAuthorizationProvider- Parameters:
context- the server call context containing the authenticated usertaskId- the task being accessed, or""for the list scope ofLIST_TASKSoperation- which RequestHandler method triggered the check- Returns:
trueto allow,falseto deny
-
checkWrite
Description copied from interface:TaskAuthorizationProviderCheck whether the current user is allowed to write to the given task.- Specified by:
checkWritein interfaceTaskAuthorizationProvider- Parameters:
context- the server call context containing the authenticated usertaskId- the task being accessedoperation- which RequestHandler method triggered the check- Returns:
trueto allow,falseto deny
-
checkCreate
Description copied from interface:TaskAuthorizationProviderCheck whether the current user is allowed to create a new task.- Specified by:
checkCreatein interfaceTaskAuthorizationProvider- Parameters:
context- the server call context containing the authenticated useroperation- which RequestHandler method triggered the check- Returns:
trueto allow,falseto deny
-
isTaskRecorded
Description copied from interface:TaskAuthorizationProviderCheck whether the given task is already known to this provider. Used to avoid redundantTaskAuthorizationProvider.recordOwnership(ServerCallContext, String, TaskOperation)calls.- Specified by:
isTaskRecordedin interfaceTaskAuthorizationProvider- Parameters:
taskId- the task to check- Returns:
trueif ownership has already been recorded for this task
-
recordOwnership
Description copied from interface:TaskAuthorizationProviderRecord that the current user owns the given task. Called after task creation viaonMessageSendoronMessageSendStream.Must be idempotent. Concurrent requests for the same unrecorded task may both call this method before either completes.
- Specified by:
recordOwnershipin interfaceTaskAuthorizationProvider- Parameters:
context- the server call context containing the authenticated usertaskId- the newly created taskoperation- which RequestHandler method triggered the recording
-