tba-concrete-authorization-policy-attributes-mapping 0.4.0.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tba_concrete_authorization_policy_attributes_mapping-0.4.0.dev2/PKG-INFO +35 -0
- tba_concrete_authorization_policy_attributes_mapping-0.4.0.dev2/README.md +5 -0
- tba_concrete_authorization_policy_attributes_mapping-0.4.0.dev2/pyproject.toml +41 -0
- tba_concrete_authorization_policy_attributes_mapping-0.4.0.dev2/src/tba_concrete_authorization_policy_attributes_mapping/__init__.py +33 -0
- tba_concrete_authorization_policy_attributes_mapping-0.4.0.dev2/src/tba_concrete_authorization_policy_attributes_mapping/py.typed +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-concrete-authorization-policy-attributes-mapping
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Mapping-backed authorization policy attribute resolver and selector.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Keywords: tigrbl,identity,auth,security
|
|
7
|
+
Requires-Python: >=3.10,<3.15
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Dist: tba-bases-authorization-policy (==0.4.0.dev2)
|
|
22
|
+
Requires-Dist: tba-contracts-identity (==0.4.0.dev2)
|
|
23
|
+
Project-URL: Homepage, https://github.com/tigrbl/tigrbl_auth
|
|
24
|
+
Project-URL: PyPI, https://pypi.org/project/tba-concrete-authorization-policy-attributes-mapping/
|
|
25
|
+
Project-URL: Repository, https://github.com/tigrbl/tigrbl_auth
|
|
26
|
+
Project-URL: Source, https://github.com/tigrbl/tigrbl_auth/tree/master/pkgs/10-concrete/tba-concrete-authorization-policy-attributes-mapping
|
|
27
|
+
Project-URL: SSOT, https://github.com/tigrbl/tigrbl_auth/blob/master/.ssot/registry.json
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# tba-concrete-authorization-policy-attributes-mapping
|
|
31
|
+
|
|
32
|
+
Mapping-backed authorization policy attribute resolver and selector.
|
|
33
|
+
|
|
34
|
+
Import root: `tba_concrete_authorization_policy_attributes_mapping`.
|
|
35
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tba-concrete-authorization-policy-attributes-mapping"
|
|
3
|
+
version = "0.4.0.dev2"
|
|
4
|
+
description = "Mapping-backed authorization policy attribute resolver and selector."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10,<3.15"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
keywords = ["tigrbl", "identity", "auth", "security"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 3 - Alpha",
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"License :: OSI Approved :: Apache Software License",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.10",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Typing :: Typed",
|
|
21
|
+
"Topic :: Security",
|
|
22
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"tba-bases-authorization-policy==0.4.0.dev2",
|
|
26
|
+
"tba-contracts-identity==0.4.0.dev2",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/tigrbl/tigrbl_auth"
|
|
31
|
+
Repository = "https://github.com/tigrbl/tigrbl_auth"
|
|
32
|
+
Source = "https://github.com/tigrbl/tigrbl_auth/tree/master/pkgs/10-concrete/tba-concrete-authorization-policy-attributes-mapping"
|
|
33
|
+
SSOT = "https://github.com/tigrbl/tigrbl_auth/blob/master/.ssot/registry.json"
|
|
34
|
+
PyPI = "https://pypi.org/project/tba-concrete-authorization-policy-attributes-mapping/"
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["poetry-core>=1.0.0"]
|
|
38
|
+
build-backend = "poetry.core.masonry.api"
|
|
39
|
+
|
|
40
|
+
[tool.poetry]
|
|
41
|
+
packages = [{ include = "tba_concrete_authorization_policy_attributes_mapping", from = "src" }]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Mapping-backed attribute resolver and selector implementations."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Mapping
|
|
6
|
+
|
|
7
|
+
from tba_bases_authorization_policy import AttributeResolverBase, AttributeSelectorBase
|
|
8
|
+
from tba_contracts_identity.policy import AttributeDesignator, AttributeSelector, PolicyRequest
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MappingAttributeResolver(AttributeResolverBase):
|
|
12
|
+
def resolve(self, designator: AttributeDesignator, request: PolicyRequest, /) -> Any:
|
|
13
|
+
if designator.attribute_id in request.attributes:
|
|
14
|
+
return request.attributes[designator.attribute_id]
|
|
15
|
+
if designator.required:
|
|
16
|
+
raise KeyError(designator.attribute_id)
|
|
17
|
+
return None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MappingAttributeSelector(AttributeSelectorBase):
|
|
21
|
+
def select(self, selector: AttributeSelector, values: Mapping[str, Any], /) -> Any:
|
|
22
|
+
current: Any = values
|
|
23
|
+
for part in selector.path:
|
|
24
|
+
if isinstance(current, Mapping) and part in current:
|
|
25
|
+
current = current[part]
|
|
26
|
+
continue
|
|
27
|
+
if selector.required:
|
|
28
|
+
raise KeyError(".".join(selector.path))
|
|
29
|
+
return None
|
|
30
|
+
return current
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__all__ = ["MappingAttributeResolver", "MappingAttributeSelector"]
|