tba-concrete-authorization-policy-evaluators-default 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.
- tba_concrete_authorization_policy_evaluators_default/__init__.py +24 -0
- tba_concrete_authorization_policy_evaluators_default/py.typed +0 -0
- tba_concrete_authorization_policy_evaluators_default-0.4.0.dev2.dist-info/METADATA +35 -0
- tba_concrete_authorization_policy_evaluators_default-0.4.0.dev2.dist-info/RECORD +5 -0
- tba_concrete_authorization_policy_evaluators_default-0.4.0.dev2.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Default policy rule and condition evaluators."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_bases_authorization_policy import ConditionEvaluatorBase, RuleEvaluatorBase
|
|
6
|
+
from tba_contracts_identity.policy import DynamicCondition, PolicyDecision, PolicyRequest, PolicyRule
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DefaultConditionEvaluator(ConditionEvaluatorBase):
|
|
10
|
+
def evaluate_condition(self, condition: DynamicCondition, request: PolicyRequest, /) -> bool:
|
|
11
|
+
return condition.evaluate(request.attributes)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DefaultRuleEvaluator(RuleEvaluatorBase):
|
|
15
|
+
def evaluate_rule(self, rule: PolicyRule, request: PolicyRequest, /) -> PolicyDecision:
|
|
16
|
+
policy_id = rule.policy_id or rule.kind.value
|
|
17
|
+
effect = str(getattr(rule.effect, "value", rule.effect))
|
|
18
|
+
matched = (policy_id,)
|
|
19
|
+
if effect == "deny":
|
|
20
|
+
return PolicyDecision(False, f"denied by {rule.kind.value} policy", matched)
|
|
21
|
+
return PolicyDecision(True, f"allowed by {rule.kind.value} policy", matched)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
__all__ = ["DefaultConditionEvaluator", "DefaultRuleEvaluator"]
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-concrete-authorization-policy-evaluators-default
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Default concrete authorization policy rule and condition evaluators.
|
|
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-evaluators-default/
|
|
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-evaluators-default
|
|
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-evaluators-default
|
|
31
|
+
|
|
32
|
+
Default concrete authorization policy rule and condition evaluators.
|
|
33
|
+
|
|
34
|
+
Import root: `tba_concrete_authorization_policy_evaluators_default`.
|
|
35
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
tba_concrete_authorization_policy_evaluators_default/__init__.py,sha256=PdHKcY35Ph487EQr1kWItje34_af_hgtP6xBhnEE6X8,1047
|
|
2
|
+
tba_concrete_authorization_policy_evaluators_default/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
tba_concrete_authorization_policy_evaluators_default-0.4.0.dev2.dist-info/METADATA,sha256=VjhqSOCpagt_4Eqaoq6Mos2Qdv0dHauzJWY00NgW2Oo,1724
|
|
4
|
+
tba_concrete_authorization_policy_evaluators_default-0.4.0.dev2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
|
|
5
|
+
tba_concrete_authorization_policy_evaluators_default-0.4.0.dev2.dist-info/RECORD,,
|