fluidattacks_core_auth 12.0.0__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,14 @@
|
|
|
1
|
+
"""Credential handling shared by every CLI that talks to the platform.
|
|
2
|
+
|
|
3
|
+
The decisions live in the shared client: which credential is in force, and what can be
|
|
4
|
+
done when the platform rejects one. What lives here is the one thing that cannot, because
|
|
5
|
+
it depends on the caller's own GraphQL client: recognising the rejection in a response.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .recovery import (
|
|
9
|
+
is_login_required,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"is_login_required",
|
|
14
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Recognise a rejected credential in a GraphQL response."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from types import ModuleType
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _rustport() -> ModuleType:
|
|
8
|
+
# Imported on use, not at module load: the extension is built by maturin, so a
|
|
9
|
+
# source checkout can import this module without it.
|
|
10
|
+
from fluidattacks_core import rustport # noqa: PLC0415
|
|
11
|
+
|
|
12
|
+
return rustport
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def is_login_required(errors: object) -> bool:
|
|
16
|
+
"""Whether a GraphQL error payload says the credential was rejected.
|
|
17
|
+
|
|
18
|
+
Pass the `errors` list the platform returned, whatever client produced it. The
|
|
19
|
+
contract lives in the shared client, so nothing here walks the payload or pins the
|
|
20
|
+
code: this only re-serialises what a Python client already parsed. On a match,
|
|
21
|
+
`rustport.recover` decides what can be done about it.
|
|
22
|
+
"""
|
|
23
|
+
if errors is None:
|
|
24
|
+
return False
|
|
25
|
+
try:
|
|
26
|
+
body = json.dumps({"errors": errors})
|
|
27
|
+
except (TypeError, ValueError):
|
|
28
|
+
return False
|
|
29
|
+
return bool(_rustport().says_login_required(body))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fluidattacks_core_auth
|
|
3
|
+
Version: 12.0.0
|
|
4
|
+
Summary: Fluid Attacks Core Auth Library
|
|
5
|
+
Author-email: Development <development@fluidattacks.com>
|
|
6
|
+
License: MPL-2.0
|
|
7
|
+
Classifier: Development Status :: 1 - Planning
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Requires-Dist: fluidattacks-core-rustport>=12.0.0
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
fluidattacks_core/auth/__init__.py,sha256=h4Cb2xkE-4ou0eAV2WaHIeEsoQVEWi3GrmPlDsuWZTs,431
|
|
2
|
+
fluidattacks_core/auth/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
fluidattacks_core/auth/recovery.py,sha256=_6eaGNvofYdzINrxq9D4JKVM8SXyhSit1nLrE6UrFwI,1010
|
|
4
|
+
fluidattacks_core_auth-12.0.0.dist-info/METADATA,sha256=EHCipEfSFAtzx0HpodQpKaiwclqI45DAx_w_y_ATMus,577
|
|
5
|
+
fluidattacks_core_auth-12.0.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
6
|
+
fluidattacks_core_auth-12.0.0.dist-info/RECORD,,
|