hardpy 0.12.1__py3-none-any.whl → 0.14.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.
- hardpy/cli/cli.py +18 -11
- hardpy/common/config.py +5 -0
- hardpy/common/stand_cloud/connector.py +142 -135
- hardpy/common/stand_cloud/oauth2.py +88 -0
- hardpy/common/stand_cloud/registration.py +50 -211
- hardpy/common/stand_cloud/token_manager.py +119 -0
- hardpy/common/stand_cloud/utils.py +33 -0
- hardpy/hardpy_panel/frontend/dist/assets/{allPaths-B26356fZ.js → allPaths-CV5wjLMB.js} +1 -1
- hardpy/hardpy_panel/frontend/dist/assets/{allPathsLoader-0BeGWuiy.js → allPathsLoader-JIzW_pSb.js} +2 -2
- hardpy/hardpy_panel/frontend/dist/assets/browser-ponyfill-CccdstaD.js +2 -0
- hardpy/hardpy_panel/frontend/dist/assets/index-6RIgWzcZ.js +790 -0
- hardpy/hardpy_panel/frontend/dist/assets/{splitPathsBySizeLoader-BEs5IL5-.js → splitPathsBySizeLoader-DkZadBcn.js} +1 -1
- hardpy/hardpy_panel/frontend/dist/index.html +1 -1
- hardpy/hardpy_panel/frontend/dist/locales/de/translation.json +60 -0
- hardpy/hardpy_panel/frontend/dist/locales/en/translation.json +60 -0
- hardpy/hardpy_panel/frontend/dist/locales/es/translation.json +60 -0
- hardpy/hardpy_panel/frontend/dist/locales/fr/translation.json +60 -0
- hardpy/hardpy_panel/frontend/dist/locales/ja/translation.json +60 -0
- hardpy/hardpy_panel/frontend/dist/locales/ru/translation.json +60 -0
- hardpy/hardpy_panel/frontend/dist/locales/zh/translation.json +60 -0
- hardpy/pytest_hardpy/plugin.py +47 -28
- hardpy/pytest_hardpy/pytest_call.py +7 -3
- hardpy/pytest_hardpy/reporter/base.py +8 -0
- hardpy/pytest_hardpy/reporter/hook_reporter.py +25 -8
- hardpy/pytest_hardpy/result/report_loader/stand_cloud_loader.py +8 -2
- {hardpy-0.12.1.dist-info → hardpy-0.14.0.dist-info}/METADATA +2 -1
- {hardpy-0.12.1.dist-info → hardpy-0.14.0.dist-info}/RECORD +30 -21
- hardpy/common/stand_cloud/oauth_callback.py +0 -95
- hardpy/common/stand_cloud/token_storage.py +0 -27
- hardpy/hardpy_panel/frontend/dist/assets/index-Bl_IX0Up.js +0 -790
- {hardpy-0.12.1.dist-info → hardpy-0.14.0.dist-info}/WHEEL +0 -0
- {hardpy-0.12.1.dist-info → hardpy-0.14.0.dist-info}/entry_points.txt +0 -0
- {hardpy-0.12.1.dist-info → hardpy-0.14.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -32,11 +32,13 @@ class StandCloudLoader:
|
|
|
32
32
|
sc_addr = address if address else connection_data.sc_address
|
|
33
33
|
self._sc_connector = StandCloudConnector(sc_addr)
|
|
34
34
|
|
|
35
|
-
def load(self, report: ResultRunStore) -> Response:
|
|
35
|
+
def load(self, report: ResultRunStore, timeout: int = 20) -> Response:
|
|
36
36
|
"""Load report to the StandCloud.
|
|
37
37
|
|
|
38
38
|
Args:
|
|
39
39
|
report (ResultRunStore): report
|
|
40
|
+
timeout (int, optional): post timeout in seconds. Defaults to 20.
|
|
41
|
+
High timeout value on poor network connections.
|
|
40
42
|
|
|
41
43
|
Returns:
|
|
42
44
|
Response: StandCloud load response, must be 201
|
|
@@ -47,7 +49,11 @@ class StandCloudLoader:
|
|
|
47
49
|
api = self._sc_connector.get_api("test_report")
|
|
48
50
|
|
|
49
51
|
try:
|
|
50
|
-
resp = api.post(
|
|
52
|
+
resp = api.post(
|
|
53
|
+
verify=self._verify_ssl,
|
|
54
|
+
json=report.model_dump(),
|
|
55
|
+
timeout=timeout,
|
|
56
|
+
)
|
|
51
57
|
except RuntimeError as exc:
|
|
52
58
|
raise StandCloudError(str(exc)) from exc
|
|
53
59
|
except OAuth2Error as exc:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hardpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.14.0
|
|
4
4
|
Summary: HardPy library for device testing
|
|
5
5
|
Project-URL: Homepage, https://github.com/everypinio/hardpy/
|
|
6
6
|
Project-URL: Documentation, https://everypinio.github.io/hardpy/
|
|
@@ -34,6 +34,7 @@ Requires-Dist: py-machineid~=0.6.0
|
|
|
34
34
|
Requires-Dist: pycouchdb<2,>=1.14.2
|
|
35
35
|
Requires-Dist: pydantic<3,>=2.4.0
|
|
36
36
|
Requires-Dist: pytest<9,>=7
|
|
37
|
+
Requires-Dist: qrcode>=8
|
|
37
38
|
Requires-Dist: requests-oauth2client<2,>=1.5.0
|
|
38
39
|
Requires-Dist: requests-oauthlib<3,>=2.0.0
|
|
39
40
|
Requires-Dist: requests<3,>=2.30.0
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
hardpy/__init__.py,sha256=49-EDyH1KzK7kmuU9zFHAe8bUPfuayzcUIk3ksXiL7s,2237
|
|
2
2
|
hardpy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
hardpy/cli/cli.py,sha256=
|
|
3
|
+
hardpy/cli/cli.py,sha256=lDROCYhl4Z2SbzlvlOCSnJylMy3iX4ff_0pHSvFWA9g,9281
|
|
4
4
|
hardpy/cli/template.py,sha256=44phTqeKgFch5xdAJmDQ-za1mM1_z60izRVbmCQHU-8,6225
|
|
5
5
|
hardpy/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
hardpy/common/config.py,sha256=
|
|
6
|
+
hardpy/common/config.py,sha256=hdBs2L0IoD5gHPaux2c0IOPg7A871FaESZLaK3CU8cI,5140
|
|
7
7
|
hardpy/common/stand_cloud/__init__.py,sha256=fezdiYAehtT2H-GAef-xZU12CbmCRe64XHA9UB3kJDU,456
|
|
8
|
-
hardpy/common/stand_cloud/connector.py,sha256=
|
|
8
|
+
hardpy/common/stand_cloud/connector.py,sha256=oAfyT4h5HPWT5JeWcUBFyymncPmGWMpNkpeefYf99xM,7318
|
|
9
9
|
hardpy/common/stand_cloud/exception.py,sha256=eKkqu5ylDRIGN_yZhvz2xVGm49XmlZ8nryALgdRqpbY,287
|
|
10
|
-
hardpy/common/stand_cloud/
|
|
11
|
-
hardpy/common/stand_cloud/registration.py,sha256=
|
|
12
|
-
hardpy/common/stand_cloud/
|
|
10
|
+
hardpy/common/stand_cloud/oauth2.py,sha256=SDqtIwcuMgqfBkEZyo3GXeVPnvRBOr6dzeXowx3ZkEw,2803
|
|
11
|
+
hardpy/common/stand_cloud/registration.py,sha256=UW-JGcvON5CMQQ-s2Mb4Ee3u_jmdQfSj3vPfZ_FuhHY,2370
|
|
12
|
+
hardpy/common/stand_cloud/token_manager.py,sha256=8dX802F0CnOrOjOQInyYCrvuRdK0CeiCrTDITAbSLgQ,4055
|
|
13
|
+
hardpy/common/stand_cloud/utils.py,sha256=GN3wzbrmF-Xe5iUXf_HurGO-YKltqd3Gc_7vG2eEL7c,692
|
|
13
14
|
hardpy/hardpy_panel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
15
|
hardpy/hardpy_panel/api.py,sha256=BRY_RuYKPo0e1WdVCPS7iA46GzLIc5A4hLPvtagKqRc,3533
|
|
15
16
|
hardpy/hardpy_panel/frontend/dist/favicon.ico,sha256=sgIk5PKUKEKBDpkSrc8dJgjpObp0iF82Mec0GpfKId4,15406
|
|
16
|
-
hardpy/hardpy_panel/frontend/dist/index.html,sha256=
|
|
17
|
+
hardpy/hardpy_panel/frontend/dist/index.html,sha256=HgsuTaNZg-rq6m18f8RRijfxcEPwQNDzb9Dxc1rkaCY,1851
|
|
17
18
|
hardpy/hardpy_panel/frontend/dist/logo192.png,sha256=E4K7drvhJCg9HcTpRihOXZhVJVBZ7-W97Se-3tDb46o,14485
|
|
18
19
|
hardpy/hardpy_panel/frontend/dist/logo512.png,sha256=-fIMbqX7PYUpheK4kX1C1erRTe_hHZwFQYDLrAbhFRU,34188
|
|
19
20
|
hardpy/hardpy_panel/frontend/dist/manifest.json,sha256=PfmJlN2JMJtHS6OnhU4b4X5wPQC_yRBdjesjoirObSA,502
|
|
20
|
-
hardpy/hardpy_panel/frontend/dist/assets/allPaths-
|
|
21
|
-
hardpy/hardpy_panel/frontend/dist/assets/allPathsLoader-
|
|
21
|
+
hardpy/hardpy_panel/frontend/dist/assets/allPaths-CV5wjLMB.js,sha256=N09wgcmig_DLDNU2XRGxwya65nrEHLFToqToqntmuc4,309
|
|
22
|
+
hardpy/hardpy_panel/frontend/dist/assets/allPathsLoader-JIzW_pSb.js,sha256=3C1eVG4e3OQX2dS_XwvpLkOkJQrh9OX3wWwLUzHXAiM,550
|
|
22
23
|
hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-Bfs1BwbR.ttf,sha256=wA1ItrnCJli8ESQ1KwLR3egJZG55dKBbLPonqFIa0K0,117420
|
|
23
24
|
hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-Btb8d-Hu.woff,sha256=edyqQN0nw4dNBs1pgr7pQB7nJhhR6T_YfklFcG_fHj0,53344
|
|
24
25
|
hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-CzsyEoPG.svg,sha256=lDCQy06aS-9bmhwuFOUs-EdcR8MP2wqwAwky5oamtkQ,509417
|
|
@@ -29,15 +30,23 @@ hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-D9WO2FSG.woff2,sha25
|
|
|
29
30
|
hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-Doom1bSH.eot,sha256=RPan5eGrt9_bHe9FXYXVYsbOA4J-BgNweKZJNaVXf2I,120680
|
|
30
31
|
hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-DyVnGNfQ.svg,sha256=BsTLtmUaqeiMSZwv2ysmTV4qWVv-qYbwsE0_sVUjJk0,546938
|
|
31
32
|
hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-ZW-9JnPf.woff,sha256=mQZTxE1PyyAL16VWuASOvXlZFwuI4aCPvbrhfgpdIdU,55356
|
|
33
|
+
hardpy/hardpy_panel/frontend/dist/assets/browser-ponyfill-CccdstaD.js,sha256=FLNVAidyg0bcRT15SkYoVOsL_YEEyjyZBQuRW6CviAs,10288
|
|
34
|
+
hardpy/hardpy_panel/frontend/dist/assets/index-6RIgWzcZ.js,sha256=8oKEqyS6CGqdCQPo5QZ8yrvDWk8tfn6jnCxgpfadFDs,1046765
|
|
32
35
|
hardpy/hardpy_panel/frontend/dist/assets/index-BMEat_ws.js,sha256=ZiKN4IGxolgim42tqk68UOPUA0g8ABojet1dj4Wru1s,254121
|
|
33
|
-
hardpy/hardpy_panel/frontend/dist/assets/index-Bl_IX0Up.js,sha256=eiRyh2G4k3lhsY2Xr5b6MvfYaMW0qKEOxw0VkZkZ8o4,984130
|
|
34
36
|
hardpy/hardpy_panel/frontend/dist/assets/index-BwCQzehg.css,sha256=uvaqKowYoduAxTwlw3ojcSjKqrMtu5XErb_T668JGdU,299275
|
|
35
37
|
hardpy/hardpy_panel/frontend/dist/assets/index-xb4M2ucX.js,sha256=eeaZrH0pRpkWViEVZ2Mt6f7VgpOxluRB7S8SovkFeTE,245762
|
|
36
38
|
hardpy/hardpy_panel/frontend/dist/assets/logo_smol-CK3jE85c.png,sha256=E4K7drvhJCg9HcTpRihOXZhVJVBZ7-W97Se-3tDb46o,14485
|
|
37
|
-
hardpy/hardpy_panel/frontend/dist/assets/splitPathsBySizeLoader-
|
|
39
|
+
hardpy/hardpy_panel/frontend/dist/assets/splitPathsBySizeLoader-DkZadBcn.js,sha256=pLRjEega0VLCJFhH8dCAPzjkLe_zIU92Hlkn_1O4EMQ,472
|
|
40
|
+
hardpy/hardpy_panel/frontend/dist/locales/de/translation.json,sha256=CyQ16ylGIPs-VSccDU35siMvrFjPpFoOk3NTncyhnOA,1954
|
|
41
|
+
hardpy/hardpy_panel/frontend/dist/locales/en/translation.json,sha256=RuITbwa-aaUIET6CPAUppaMcLeuxsB6ijq4ep2LnVZw,1803
|
|
42
|
+
hardpy/hardpy_panel/frontend/dist/locales/es/translation.json,sha256=UVENIDh-mBphPVIOLPK17VObTmlsCmJ_wkI9hc_uZSE,2019
|
|
43
|
+
hardpy/hardpy_panel/frontend/dist/locales/fr/translation.json,sha256=zjXb_cGXE55sTnOMe5fMtK0FDiOa9IVp55RRXanVHgw,2012
|
|
44
|
+
hardpy/hardpy_panel/frontend/dist/locales/ja/translation.json,sha256=xSDe9TN1f3gywlGFbD0O9jS1J7ikrv9QWxStPfT_ssc,2199
|
|
45
|
+
hardpy/hardpy_panel/frontend/dist/locales/ru/translation.json,sha256=Zo_5GhOFIwOnpQITD5x2Q7CYTI9Pdpvv844_ieW56jY,2609
|
|
46
|
+
hardpy/hardpy_panel/frontend/dist/locales/zh/translation.json,sha256=uxYSv8eXTMDewPvbFZSh21ZP0Wy4mx32XbbVkzXzlls,1790
|
|
38
47
|
hardpy/pytest_hardpy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
hardpy/pytest_hardpy/plugin.py,sha256=
|
|
40
|
-
hardpy/pytest_hardpy/pytest_call.py,sha256=
|
|
48
|
+
hardpy/pytest_hardpy/plugin.py,sha256=vyG2LvZj5NC_M2iXmVNlGZJJFOpGwtviGbhMCHtyQqE,20017
|
|
49
|
+
hardpy/pytest_hardpy/pytest_call.py,sha256=TNDcbH0uuquqpNVjT_MGXZ8ukpze3ceWA5M4DUuKuEM,13279
|
|
41
50
|
hardpy/pytest_hardpy/pytest_wrapper.py,sha256=_eULTqbJhFj0uu3XPplS4WSrI_LJC_ZX2kA5t5YJ49U,5162
|
|
42
51
|
hardpy/pytest_hardpy/db/__init__.py,sha256=G6y13JPh8HaH2O9E3_LTH_bTUVSgiezQFjDGaNIljec,557
|
|
43
52
|
hardpy/pytest_hardpy/db/base_connector.py,sha256=5a476F5LwvFUfQ4Yc0Q6biacULDrCk8UHPlpc6n0NRQ,1111
|
|
@@ -49,14 +58,14 @@ hardpy/pytest_hardpy/db/statestore.py,sha256=0sv4AqzwW_J34O-cb7aN3zmgULIVtZRi_qg
|
|
|
49
58
|
hardpy/pytest_hardpy/db/schema/__init__.py,sha256=1S73W3PLQt8gX5Y33nbX1JdwLvnrtlKH4cElID3pwuc,263
|
|
50
59
|
hardpy/pytest_hardpy/db/schema/v1.py,sha256=lWE5jWh5ek43-i4aKO51lflNPoyyzaveV06PP5nKQ3Y,9897
|
|
51
60
|
hardpy/pytest_hardpy/reporter/__init__.py,sha256=rztpM2HlLUpMOvad0JHbZU4Mk8PDDQyCFXLhpLktGQI,322
|
|
52
|
-
hardpy/pytest_hardpy/reporter/base.py,sha256=
|
|
53
|
-
hardpy/pytest_hardpy/reporter/hook_reporter.py,sha256=
|
|
61
|
+
hardpy/pytest_hardpy/reporter/base.py,sha256=KRkc5a7yk9ZsQ92gnBdHhJEXSSQiTWbEMSMzRMpJDFY,2915
|
|
62
|
+
hardpy/pytest_hardpy/reporter/hook_reporter.py,sha256=0xdga2rqwxUJKpkX6t7XaY9hPdhoKmisIDoZ6IJVXXQ,13027
|
|
54
63
|
hardpy/pytest_hardpy/reporter/runner_reporter.py,sha256=YsK8wrLIulsixePG6WNfC4MagpKfhP5j0CUaXkcfeL0,790
|
|
55
64
|
hardpy/pytest_hardpy/result/__init__.py,sha256=2afpuEuOcxYfIEOwWzsGZe960iQaPVCmsbYujijQg1s,592
|
|
56
65
|
hardpy/pytest_hardpy/result/couchdb_config.py,sha256=ujxyJYM2pdZzi3GZ2Zysbz2_ZeTRN5sQc8AGuzRJm_0,3243
|
|
57
66
|
hardpy/pytest_hardpy/result/report_loader/__init__.py,sha256=wq5Y-_JW2ExCRnQ9VVesKmTToEQrcTY5RxNJIWaT9ag,374
|
|
58
67
|
hardpy/pytest_hardpy/result/report_loader/couchdb_loader.py,sha256=KcZ0JkCgWhrj2J9M04JBDy0fpqtpVEYtu9GCLDG27pU,2255
|
|
59
|
-
hardpy/pytest_hardpy/result/report_loader/stand_cloud_loader.py,sha256=
|
|
68
|
+
hardpy/pytest_hardpy/result/report_loader/stand_cloud_loader.py,sha256=daS4cM3egwj8ej6yjLAMlM5zBIOwbWBBroF47nukQ5s,2478
|
|
60
69
|
hardpy/pytest_hardpy/result/report_reader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
70
|
hardpy/pytest_hardpy/result/report_reader/couchdb_reader.py,sha256=GrROwfTVyJaVLPBxkvOM35HCksFEnWm0aVI8FibPikg,5911
|
|
62
71
|
hardpy/pytest_hardpy/result/report_reader/stand_cloud_reader.py,sha256=uT7YSBu1QyURH9IkgRCdpbinn8LKXUhgVEhwPmGZV7I,3636
|
|
@@ -69,8 +78,8 @@ hardpy/pytest_hardpy/utils/machineid.py,sha256=6JAzUt7KtjTYn8kL9hSMaCQ20U8liH-zD
|
|
|
69
78
|
hardpy/pytest_hardpy/utils/node_info.py,sha256=BibPo2ltxy-hIUQbaYA2om7x1LNK1JvQtHNC0EKl_9k,5474
|
|
70
79
|
hardpy/pytest_hardpy/utils/progress_calculator.py,sha256=TPl2gG0ZSvMe8otPythhF9hkD6fa6-mJAhy9yI83-yE,1071
|
|
71
80
|
hardpy/pytest_hardpy/utils/singleton.py,sha256=tjUGs48o_vBeVpRsEBZEOTCoCUikpIFmQ1c3rsfymso,948
|
|
72
|
-
hardpy-0.
|
|
73
|
-
hardpy-0.
|
|
74
|
-
hardpy-0.
|
|
75
|
-
hardpy-0.
|
|
76
|
-
hardpy-0.
|
|
81
|
+
hardpy-0.14.0.dist-info/METADATA,sha256=yf8fnqjcOSPBeFpPwMBR0P4oc9IZ3LkyMca8TWdrfXk,4003
|
|
82
|
+
hardpy-0.14.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
83
|
+
hardpy-0.14.0.dist-info/entry_points.txt,sha256=nL2sMkKMScNaOE0IPkYnu9Yr-BUswZvGSrwY-SxHY3E,102
|
|
84
|
+
hardpy-0.14.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
85
|
+
hardpy-0.14.0.dist-info/RECORD,,
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Everypin
|
|
2
|
-
# GNU General Public License v3.0 (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
-
|
|
4
|
-
import json
|
|
5
|
-
from http import HTTPStatus
|
|
6
|
-
|
|
7
|
-
from fastapi import FastAPI, Request
|
|
8
|
-
from fastapi.responses import HTMLResponse
|
|
9
|
-
from fastapi.templating import Jinja2Templates
|
|
10
|
-
|
|
11
|
-
app = FastAPI()
|
|
12
|
-
|
|
13
|
-
templates = Jinja2Templates(directory="templates")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@app.route("/oauth2/callback")
|
|
17
|
-
async def index(request: Request) -> None:
|
|
18
|
-
"""OAuth2 callback page."""
|
|
19
|
-
print(json.dumps(dict(request.query_params))) # noqa: T201
|
|
20
|
-
success_template = """
|
|
21
|
-
<html><body>
|
|
22
|
-
<h1>😎 Success</h1>
|
|
23
|
-
<p>You have been redirected from the Authentication Portal<p>
|
|
24
|
-
<p>Your received response data:</p>
|
|
25
|
-
<ul>
|
|
26
|
-
<li><b>Authorization Code</b>: <i>{{code}}</i></li>
|
|
27
|
-
<li><b>Issuer</b>: <i>{{iss}}</i></li>
|
|
28
|
-
<li><b>Scope of the access request</b>: <i>{{scope}}</i></li>
|
|
29
|
-
<li><b>State data</b>: <i>{{state}}</i></li>
|
|
30
|
-
</ul>
|
|
31
|
-
<p>It is the technical data needed by the application that requests access token.</p>
|
|
32
|
-
<p>Probably, the application already received this information.</p>
|
|
33
|
-
<p><b>ℹ️ You can close the window</b></p>
|
|
34
|
-
</body></html>
|
|
35
|
-
""" # noqa: E501, RUF001
|
|
36
|
-
|
|
37
|
-
error_template = """
|
|
38
|
-
<html><body>
|
|
39
|
-
<h1>😞 Error: '{{error}}'</h1>
|
|
40
|
-
<p>You have been redirected from the Authentication Portal<p>
|
|
41
|
-
<p>Your received response data:</p>
|
|
42
|
-
<ul>
|
|
43
|
-
<li><b>Error description</b>: <i>{{error_description}}</i></li>
|
|
44
|
-
<li><b>Issuer</b>: <i>{{iss}}</i></li>
|
|
45
|
-
<li><b>State data</b>: <i>{{state}}</i></li>
|
|
46
|
-
</ul>
|
|
47
|
-
<p>It is the technical data needed by the application that requests access token.</p>
|
|
48
|
-
<p>Probably, the application already received this information.</p>
|
|
49
|
-
<p><b>ℹ️ You can close the window</b></p>
|
|
50
|
-
</body></html>
|
|
51
|
-
""" # noqa: E501, RUF001
|
|
52
|
-
|
|
53
|
-
if request.query_params.get("code") is not None:
|
|
54
|
-
return HTMLResponse(
|
|
55
|
-
content=success_template.replace(
|
|
56
|
-
"{{code}}",
|
|
57
|
-
request.query_params.get("code"), # type: ignore
|
|
58
|
-
)
|
|
59
|
-
.replace("{{iss}}", request.query_params.get("iss"))
|
|
60
|
-
.replace("{{scope}}", request.query_params.get("scope"))
|
|
61
|
-
.replace("{{state}}", request.query_params.get("state")),
|
|
62
|
-
status_code=HTTPStatus.OK,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
if request.query_params.get("error") is not None:
|
|
66
|
-
return HTMLResponse(
|
|
67
|
-
content=error_template.replace(
|
|
68
|
-
"{{error}}",
|
|
69
|
-
request.query_params.get("error"), # type: ignore
|
|
70
|
-
)
|
|
71
|
-
.replace(
|
|
72
|
-
"{{error_description}}",
|
|
73
|
-
request.query_params.get("error_description"),
|
|
74
|
-
)
|
|
75
|
-
.replace("{{iss}}", request.query_params.get("iss"))
|
|
76
|
-
.replace("{{state}}", request.query_params.get("state")),
|
|
77
|
-
status_code=HTTPStatus.OK,
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
server_error = """
|
|
81
|
-
<html><body>
|
|
82
|
-
<h1>Internal Server Error'</h1>
|
|
83
|
-
</body></html>
|
|
84
|
-
"""
|
|
85
|
-
|
|
86
|
-
return HTMLResponse(
|
|
87
|
-
content=server_error,
|
|
88
|
-
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
|
|
89
|
-
) # type: ignore
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if __name__ == "__main__":
|
|
93
|
-
import uvicorn
|
|
94
|
-
|
|
95
|
-
uvicorn.run(app, host="127.0.0.1", port=8088)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Everypin
|
|
2
|
-
# GNU General Public License v3.0 (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from platform import system
|
|
6
|
-
from typing import TYPE_CHECKING
|
|
7
|
-
|
|
8
|
-
from keyring.core import load_keyring
|
|
9
|
-
|
|
10
|
-
if TYPE_CHECKING:
|
|
11
|
-
from keyring.backend import KeyringBackend
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def get_token_store() -> tuple[KeyringBackend, KeyringBackend]:
|
|
15
|
-
"""Get token store.
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
tuple[KeyringBackend, KeyringBackend]: token store
|
|
19
|
-
"""
|
|
20
|
-
if system() == "Linux":
|
|
21
|
-
storage_keyring = load_keyring("keyring.backends.SecretService.Keyring")
|
|
22
|
-
elif system() == "Windows":
|
|
23
|
-
storage_keyring = load_keyring("keyring.backends.Windows.WinVaultKeyring")
|
|
24
|
-
# TODO(xorialexandrov): add memory keyring or other store
|
|
25
|
-
mem_keyring = storage_keyring
|
|
26
|
-
|
|
27
|
-
return storage_keyring, mem_keyring
|