qwak-core 0.4.254__py3-none-any.whl → 0.4.255__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.
qwak/__init__.py
CHANGED
qwak/inner/tool/auth.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
import warnings
|
2
2
|
from filelock import FileLock
|
3
|
+
from typing_extensions import Self
|
4
|
+
|
3
5
|
from qwak.inner.di_configuration.session import Session
|
4
6
|
from abc import ABC, abstractmethod
|
5
7
|
from typing import Optional
|
@@ -131,6 +133,8 @@ class Auth0ClientBase(BaseAuthClient):
|
|
131
133
|
|
132
134
|
|
133
135
|
class FrogMLAuthClient(BaseAuthClient):
|
136
|
+
__MIN_TOKEN_LENGTH: int = 64
|
137
|
+
|
134
138
|
def __init__(self, auth_config: Optional[AuthConfig] = None):
|
135
139
|
self.auth_config = auth_config
|
136
140
|
self._token = None
|
@@ -148,32 +152,45 @@ class FrogMLAuthClient(BaseAuthClient):
|
|
148
152
|
|
149
153
|
def login(self) -> None:
|
150
154
|
artifactory_url, auth = get_credentials(self.auth_config)
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
"Failed to authenticate with JFrog. Please check your credentials"
|
175
|
-
)
|
176
|
-
except ValueError: # This catches JSON decode errors
|
155
|
+
# For now, we only support Bearer token authentication
|
156
|
+
if not hasattr(auth, "token"):
|
157
|
+
return
|
158
|
+
|
159
|
+
# noinspection PyUnresolvedReferences
|
160
|
+
self._token = auth.token
|
161
|
+
self.__validate_token()
|
162
|
+
|
163
|
+
# Remove '/artifactory/' from the URL
|
164
|
+
if "/artifactory" in artifactory_url:
|
165
|
+
base_url = artifactory_url.replace("/artifactory", "/ui")
|
166
|
+
else:
|
167
|
+
# Remove trailing slash if it exists and append /ui
|
168
|
+
base_url = artifactory_url.rstrip("/") + "/ui"
|
169
|
+
try:
|
170
|
+
response = requests.get(
|
171
|
+
f"{base_url}/api/v1/system/auth/screen/footer",
|
172
|
+
headers={"Authorization": f"Bearer {self._token}"},
|
173
|
+
timeout=60,
|
174
|
+
)
|
175
|
+
response.raise_for_status() # Raises an HTTPError for bad responses
|
176
|
+
response_data = response.json()
|
177
|
+
if "serverId" not in response_data:
|
177
178
|
raise QwakLoginException(
|
178
179
|
"Failed to authenticate with JFrog. Please check your credentials"
|
179
180
|
)
|
181
|
+
self._tenant_id = response_data["serverId"]
|
182
|
+
except requests.exceptions.RequestException:
|
183
|
+
raise QwakLoginException(
|
184
|
+
"Failed to authenticate with JFrog. Please check your credentials"
|
185
|
+
)
|
186
|
+
except ValueError: # This catches JSON decode errors
|
187
|
+
raise QwakLoginException(
|
188
|
+
"Failed to authenticate with JFrog. Please check your credentials"
|
189
|
+
)
|
190
|
+
|
191
|
+
def __validate_token(self: Self):
|
192
|
+
if self._token is None or len(self._token) <= self.__MIN_TOKEN_LENGTH:
|
193
|
+
raise QwakLoginException(
|
194
|
+
"Authentication with JFrog failed: Only JWT Access Tokens are supported. "
|
195
|
+
"Please ensure you are using a valid JWT Access Token."
|
196
|
+
)
|
@@ -591,7 +591,7 @@ _qwak_proto/qwak/workspace/workspace_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXH
|
|
591
591
|
_qwak_proto/qwak/workspace/workspace_service_pb2.py,sha256=AB3C9S_AbOD7Nx1Ni4j1rW6PNtYTV1zjiqFQk-goQ74,21429
|
592
592
|
_qwak_proto/qwak/workspace/workspace_service_pb2.pyi,sha256=nKKCHwnovZhsy8TSVmdz-Vtl0nviOOoX56HD-41Xo08,13726
|
593
593
|
_qwak_proto/qwak/workspace/workspace_service_pb2_grpc.py,sha256=yKGuexxTBza99Ihe0DSTniV2ZSd_AG47inHenqfi890,27193
|
594
|
-
qwak/__init__.py,sha256=
|
594
|
+
qwak/__init__.py,sha256=3dkAB_9JMGnCQG2Ps-aQm0YkAXM28MfsFCPfREM5epM,587
|
595
595
|
qwak/automations/__init__.py,sha256=qFZRvCxUUn8gcxkJR0v19ulHW2oJ0x6-Rif7HiheDP4,1522
|
596
596
|
qwak/automations/automation_executions.py,sha256=5MeH_epYYWb8NKXgAozwT_jPyyUDednBHG7izloi7RY,3228
|
597
597
|
qwak/automations/automations.py,sha256=3yx8e2v0uSKDnXbqyknasyEoQ5vxGni6K40Hbi1_zkk,12599
|
@@ -846,7 +846,7 @@ qwak/inner/runtime_di/__init__.py,sha256=ylaHwo2Hlq3pmeziA0Ip87DMnkcuBffKKi0tTH7
|
|
846
846
|
qwak/inner/runtime_di/containers.py,sha256=-AREM-IUAd9JhrhQablqixxpj4L9Tk1iQkK1fA5YbrA,545
|
847
847
|
qwak/inner/singleton_meta.py,sha256=1cU99I0f9tjuMQLMJyLsK1oK3fZJMsO5-TbRHAMXqds,627
|
848
848
|
qwak/inner/tool/__init__.py,sha256=DDoMZk7LIZNfu63Ft0mLE5wflwlQoghAJ1ZmMAcAeVE,74
|
849
|
-
qwak/inner/tool/auth.py,sha256=
|
849
|
+
qwak/inner/tool/auth.py,sha256=nCDtphlFkwgIrVewSrI9p1vh-63rB-cARXFtVl8XHcY,6878
|
850
850
|
qwak/inner/tool/grpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
851
851
|
qwak/inner/tool/grpc/grpc_auth.py,sha256=nHfIk2R5ljCvU8hsgk_X6grfNhVrbTvQe6uJffe5W5o,2291
|
852
852
|
qwak/inner/tool/grpc/grpc_tools.py,sha256=ArtsEZz5V-YxOVE6vH_UHJwOn6gAJVIolda8hF6qwMs,7256
|
@@ -1065,6 +1065,6 @@ qwak_services_mock/mocks/workspace_manager_service_mock.py,sha256=O9ZSwln4T4kHVk
|
|
1065
1065
|
qwak_services_mock/services_mock.py,sha256=zXtHcX8a_acz7ynxuCBxxVpHpde7aAGjIn6Uw52LY1s,19593
|
1066
1066
|
qwak_services_mock/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1067
1067
|
qwak_services_mock/utils/service_utils.py,sha256=ZlB0CnB1J6oBn6_m7fQO2U8tKoboHdUa6ljjkRMYNXU,265
|
1068
|
-
qwak_core-0.4.
|
1069
|
-
qwak_core-0.4.
|
1070
|
-
qwak_core-0.4.
|
1068
|
+
qwak_core-0.4.255.dist-info/METADATA,sha256=ZB0CZRLVAF5CZt9UvEbedeb9P3UOeUanH1_rptHovkU,2549
|
1069
|
+
qwak_core-0.4.255.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
1070
|
+
qwak_core-0.4.255.dist-info/RECORD,,
|
File without changes
|