frogml-core 0.0.78__py3-none-any.whl → 0.0.79__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.
frogml_core/__init__.py
CHANGED
frogml_core/inner/tool/auth.py
CHANGED
@@ -5,40 +5,44 @@ from frogml_storage._utils import BearerAuth
|
|
5
5
|
from frogml_storage.authentication._authentication_utils import get_credentials
|
6
6
|
from frogml_storage.authentication.models._auth_config import AuthConfig
|
7
7
|
from requests.auth import AuthBase
|
8
|
+
from typing_extensions import Self
|
8
9
|
|
9
10
|
from frogml_core.exceptions import FrogmlLoginException
|
10
11
|
|
11
12
|
|
12
13
|
class FrogMLAuthClient:
|
13
|
-
|
14
|
+
__MIN_TOKEN_LENGTH: int = 64
|
15
|
+
|
16
|
+
def __init__(self: Self, auth_config: Optional[AuthConfig] = None):
|
14
17
|
self.auth_config: Optional[AuthConfig] = auth_config
|
15
18
|
self._token: Optional[str] = None
|
16
19
|
self._tenant_id: Optional[str] = None
|
17
20
|
|
18
|
-
def get_token(self) -> str:
|
21
|
+
def get_token(self: Self) -> str:
|
19
22
|
if not self._token:
|
20
23
|
self.login()
|
21
24
|
|
22
25
|
return cast(str, self._token)
|
23
26
|
|
24
|
-
def get_tenant_id(self) -> str:
|
27
|
+
def get_tenant_id(self: Self) -> str:
|
25
28
|
if not self._tenant_id:
|
26
29
|
self.login()
|
27
30
|
|
28
31
|
return cast(str, self._tenant_id)
|
29
32
|
|
30
|
-
def login(self):
|
33
|
+
def login(self: Self):
|
31
34
|
artifactory_url, auth = get_credentials(self.auth_config)
|
32
35
|
|
33
36
|
if isinstance(auth, BearerAuth): # For BearerAuth
|
37
|
+
self.__validate_token(auth.token)
|
34
38
|
self._token = auth.token
|
35
39
|
|
36
40
|
self.__get_tenant_id(artifactory_url, auth)
|
37
41
|
|
38
|
-
def get_auth(self) -> Union[AuthBase]:
|
42
|
+
def get_auth(self: Self) -> Union[AuthBase]:
|
39
43
|
return get_credentials(self.auth_config)[1]
|
40
44
|
|
41
|
-
def __get_tenant_id(self, artifactory_url: str, auth: AuthBase):
|
45
|
+
def __get_tenant_id(self: Self, artifactory_url: str, auth: AuthBase):
|
42
46
|
login_exception = FrogmlLoginException(
|
43
47
|
"Failed to authenticate with JFrog. Please check your credentials"
|
44
48
|
)
|
@@ -63,3 +67,10 @@ class FrogMLAuthClient:
|
|
63
67
|
|
64
68
|
except (requests.exceptions.RequestException, ValueError) as exc:
|
65
69
|
raise login_exception from exc
|
70
|
+
|
71
|
+
def __validate_token(self: Self, token: Optional[str]):
|
72
|
+
if token is None or len(token) <= self.__MIN_TOKEN_LENGTH:
|
73
|
+
raise FrogmlLoginException(
|
74
|
+
"Authentication with JFrog failed: Only JWT Access Tokens are supported. "
|
75
|
+
"Please ensure you are using a valid JWT Access Token."
|
76
|
+
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
frogml_core/__init__.py,sha256=
|
1
|
+
frogml_core/__init__.py,sha256=Obj8skKjosyVzjEKbjkibFypwfZ7R0PqFtH-YOurzqo,777
|
2
2
|
frogml_core/automations/__init__.py,sha256=j2gD15MN-xVWhI5rAFsDwhL0CIyICLNT0scXsKvNBkU,1547
|
3
3
|
frogml_core/automations/automation_executions.py,sha256=xpOb9Dq8gPPGNQDJTvBBZbNz4woZDRZY0HqnLSu7pwU,3230
|
4
4
|
frogml_core/automations/automations.py,sha256=GKEQyQMi8sxX5oZn62PaxPi0zD8IaJRjBkhczRJxHNs,13070
|
@@ -281,7 +281,7 @@ frogml_core/inner/runtime_di/__init__.py,sha256=HXqtejgH3J9TXjnEBT6cNwnTDPq6v3sT
|
|
281
281
|
frogml_core/inner/runtime_di/containers.py,sha256=LbapepWFjBjkELEOTK7m7AJEfj4KENVDlpD7lv7zw6o,577
|
282
282
|
frogml_core/inner/singleton_meta.py,sha256=1cU99I0f9tjuMQLMJyLsK1oK3fZJMsO5-TbRHAMXqds,627
|
283
283
|
frogml_core/inner/tool/__init__.py,sha256=rmOSE-ejnzDG_H7kbikPQxEO4TFIkhBWjOXhTIrldiU,35
|
284
|
-
frogml_core/inner/tool/auth.py,sha256=
|
284
|
+
frogml_core/inner/tool/auth.py,sha256=H0tQTc8JgEGLxv79IS_28jahi8cq8NNoP3lpxlQshPs,2714
|
285
285
|
frogml_core/inner/tool/grpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
286
286
|
frogml_core/inner/tool/grpc/grpc_auth.py,sha256=WPFWn7CfGp-pSqlnUTplHB6lfuJdzpS6jeidmpyondo,1421
|
287
287
|
frogml_core/inner/tool/grpc/grpc_tools.py,sha256=8sXDWBd_kVRuwmUSdpQNobylT6u8H_83Q8WlZJYOi0c,7247
|
@@ -1096,6 +1096,6 @@ frogml_services_mock/mocks/workspace_manager_service_mock.py,sha256=WbOiWgOyr-xT
|
|
1096
1096
|
frogml_services_mock/services_mock.py,sha256=xfbYvl05gFUq2oT82cT-6K2CEJ6d9kFX_tk77QZHTFI,20787
|
1097
1097
|
frogml_services_mock/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1098
1098
|
frogml_services_mock/utils/service_utils.py,sha256=ZlB0CnB1J6oBn6_m7fQO2U8tKoboHdUa6ljjkRMYNXU,265
|
1099
|
-
frogml_core-0.0.
|
1100
|
-
frogml_core-0.0.
|
1101
|
-
frogml_core-0.0.
|
1099
|
+
frogml_core-0.0.79.dist-info/METADATA,sha256=u1qoVO96CDfDjfgs8orTURNoTD-jG84jhksQOkQzZig,2004
|
1100
|
+
frogml_core-0.0.79.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
1101
|
+
frogml_core-0.0.79.dist-info/RECORD,,
|
File without changes
|