tba-concrete-acr-evaluator-basic 0.4.0.dev2__py3-none-any.whl

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.
@@ -0,0 +1,32 @@
1
+ from tba_bases_authentication_context import AcrEvaluatorBase
2
+ from tba_contracts_security_trust import (
3
+ AcrEvaluationRequest,
4
+ AcrEvaluationResult,
5
+ CapabilityMap,
6
+ )
7
+
8
+
9
+ class BasicAcrEvaluator(AcrEvaluatorBase):
10
+ """Evaluate an achieved ACR by exact requested-value membership."""
11
+
12
+ def supports(self) -> CapabilityMap:
13
+ return CapabilityMap(ops={"evaluate_acr": ("basic",)}, features=("acr",))
14
+
15
+ def evaluate_acr(self, request: AcrEvaluationRequest) -> AcrEvaluationResult:
16
+ achieved = request.achieved
17
+ requested = tuple(
18
+ str(getattr(value, "value", value)) for value in request.requested
19
+ )
20
+ if not requested:
21
+ return AcrEvaluationResult(True, achieved)
22
+ value = (
23
+ str(getattr(achieved, "value", achieved)) if achieved is not None else ""
24
+ )
25
+ return AcrEvaluationResult(
26
+ value in requested,
27
+ achieved,
28
+ None if value in requested else "acr_not_satisfied",
29
+ )
30
+
31
+
32
+ __all__ = ["BasicAcrEvaluator"]
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: tba-concrete-acr-evaluator-basic
3
+ Version: 0.4.0.dev2
4
+ Summary: Deterministic basic ACR evaluator.
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.10,<3.15
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Requires-Dist: tba-bases-authentication-context (==0.4.0.dev2)
14
+ Requires-Dist: tba-contracts-security-trust (==0.1.0)
@@ -0,0 +1,5 @@
1
+ tba_concrete_acr_evaluator_basic/__init__.py,sha256=fM877HQL9Rth5tGfjzJ4_LA7n9dR8HPcJ5rY0egcH_8,1047
2
+ tba_concrete_acr_evaluator_basic/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
+ tba_concrete_acr_evaluator_basic-0.4.0.dev2.dist-info/METADATA,sha256=Ittm2GJLAw4cAsM5UhpG7vDxkmy8hIIfUx5aEsnuXno,606
4
+ tba_concrete_acr_evaluator_basic-0.4.0.dev2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
5
+ tba_concrete_acr_evaluator_basic-0.4.0.dev2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.5.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any