diff --git a/packages/toolbox-core/src/toolbox_core/sync_tool.py b/packages/toolbox-core/src/toolbox_core/sync_tool.py index 565bdc8c..db6febf8 100644 --- a/packages/toolbox-core/src/toolbox_core/sync_tool.py +++ b/packages/toolbox-core/src/toolbox_core/sync_tool.py @@ -108,8 +108,12 @@ def _bound_params( return self.__async_tool._bound_params @property - def _required_auth_params(self) -> Mapping[str, list[str]]: - return self.__async_tool._required_auth_params + def _required_authn_params(self) -> Mapping[str, list[str]]: + return self.__async_tool._required_authn_params + + @property + def _required_authz_tokens(self) -> Sequence[str]: + return self.__async_tool._required_authz_tokens @property def _auth_service_token_getters( diff --git a/packages/toolbox-core/src/toolbox_core/tool.py b/packages/toolbox-core/src/toolbox_core/tool.py index 1d3c25e7..48a31dab 100644 --- a/packages/toolbox-core/src/toolbox_core/tool.py +++ b/packages/toolbox-core/src/toolbox_core/tool.py @@ -155,9 +155,13 @@ def _bound_params( return MappingProxyType(self.__bound_parameters) @property - def _required_auth_params(self) -> Mapping[str, list[str]]: + def _required_authn_params(self) -> Mapping[str, list[str]]: return MappingProxyType(self.__required_authn_params) + @property + def _required_authz_tokens(self) -> Sequence[str]: + return tuple(self.__required_authz_tokens) + @property def _auth_service_token_getters( self, diff --git a/packages/toolbox-core/tests/test_sync_tool.py b/packages/toolbox-core/tests/test_sync_tool.py index dd481bab..43b03bc3 100644 --- a/packages/toolbox-core/tests/test_sync_tool.py +++ b/packages/toolbox-core/tests/test_sync_tool.py @@ -155,12 +155,23 @@ def test_toolbox_sync_tool_underscore_bound_params_property( assert toolbox_sync_tool._bound_params == mock_async_tool._bound_params -def test_toolbox_sync_tool_underscore_required_auth_params_property( +def test_toolbox_sync_tool_underscore_required_authn_params_property( toolbox_sync_tool: ToolboxSyncTool, mock_async_tool: MagicMock ): - """Tests the _required_auth_params property.""" + """Tests the _required_authn_params property.""" assert ( - toolbox_sync_tool._required_auth_params == mock_async_tool._required_auth_params + toolbox_sync_tool._required_authn_params + == mock_async_tool._required_authn_params + ) + + +def test_toolbox_sync_tool_underscore_required_authz_tokens_property( + toolbox_sync_tool: ToolboxSyncTool, mock_async_tool: MagicMock +): + """Tests the _required_authz_tokens property.""" + assert ( + toolbox_sync_tool._required_authz_tokens + == mock_async_tool._required_authz_tokens ) diff --git a/packages/toolbox-core/tests/test_tool.py b/packages/toolbox-core/tests/test_tool.py index 0c624657..2e918c3d 100644 --- a/packages/toolbox-core/tests/test_tool.py +++ b/packages/toolbox-core/tests/test_tool.py @@ -575,16 +575,28 @@ def test_toolbox_tool_underscore_bound_params_property(toolbox_tool: ToolboxTool bound_params["new_param"] = "new_value" -def test_toolbox_tool_underscore_required_auth_params_property( +def test_toolbox_tool_underscore_required_authn_params_property( toolbox_tool: ToolboxTool, ): - """Tests the _required_auth_params property returns an immutable MappingProxyType.""" - required_auth_params = toolbox_tool._required_auth_params - assert required_auth_params == {"message": ["service_a"]} - assert isinstance(required_auth_params, MappingProxyType) + """Tests the _required_authn_params property returns an immutable MappingProxyType.""" + required_authn_params = toolbox_tool._required_authn_params + assert required_authn_params == {"message": ["service_a"]} + assert isinstance(required_authn_params, MappingProxyType) # Verify immutability with pytest.raises(TypeError): - required_auth_params["new_param"] = ["new_service"] + required_authn_params["new_param"] = ["new_service"] + + +def test_toolbox_tool_underscore_required_authz_tokens_property( + toolbox_tool: ToolboxTool, +): + """Tests the _required_authz_tokens property returns an immutable MappingProxyType.""" + required_authz_tokens = toolbox_tool._required_authz_tokens + assert required_authz_tokens == ("service_b",) + assert isinstance(required_authz_tokens, tuple) + # Verify immutability + with pytest.raises(TypeError): + required_authz_tokens[0] = "new_service" def test_toolbox_tool_underscore_auth_service_token_getters_property(