cardo-python-utils 0.5.dev47__py3-none-any.whl → 0.5.dev48__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cardo-python-utils
3
- Version: 0.5.dev47
3
+ Version: 0.5.dev48
4
4
  Summary: Python library enhanced with a wide range of functions for different scenarios.
5
5
  Author-email: CardoAI <hello@cardoai.com>
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- cardo_python_utils-0.5.dev47.dist-info/licenses/LICENSE,sha256=N-YtxDy8n5A1Mo7JKKItNIlboiK_pMOZ48ojx76jo3g,1046
1
+ cardo_python_utils-0.5.dev48.dist-info/licenses/LICENSE,sha256=N-YtxDy8n5A1Mo7JKKItNIlboiK_pMOZ48ojx76jo3g,1046
2
2
  python_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  python_utils/choices.py,sha256=_sLNkSnQqhg55gGKNRsOQCJ75W6gnz8J8Q00528MEYk,2548
4
4
  python_utils/data_structures.py,sha256=ZqkZYPy20zyGYOVhwb9qst4vF_P7X2A9z5E36rMUC6I,16820
@@ -14,7 +14,7 @@ python_utils/types_hinting.py,sha256=QVWzmXRgNxhvln14tEX_FbQYryuVYhjWJ0dVOnlF6G4
14
14
  python_utils/django/README.md,sha256=J6zy05R4DC43gYFF9_fYz7T9zxDmFn7IkYh5OByePRY,6213
15
15
  python_utils/django/__init__.py,sha256=uXyqF-_5gZAlSIKoQkUTedAeBjnUHqh6lR6SzA1DEOM,64
16
16
  python_utils/django/apps.py,sha256=vH2Ov8XgavTGKFLSjbH1kvuG7RWQCjeJepw6BSp2o3E,126
17
- python_utils/django/oidc_settings.py,sha256=EQlZeJrYy0c5X2Q3jmr4XEUm6HOUZqeKPFeM1HwKHbM,4330
17
+ python_utils/django/oidc_settings.py,sha256=JqF-qOfW23JhmmVciN1B7ZV-KI7qrdn5VigTE7E2k_0,4367
18
18
  python_utils/django/settings.py,sha256=dbu4QPvG8N_z7P8eisEgI4qNwy2T8ZPNDkx9FoK4FEs,624
19
19
  python_utils/django/tenant_context.py,sha256=9LN15__PGhajy7raK382vVx8r5k90VUwUZJS4ylW0yA,3231
20
20
  python_utils/django/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -62,7 +62,7 @@ python_utils/django/storage/__init__.py,sha256=mNn2YmD7pkXhBLHMM1444BLsCMq78YdYx
62
62
  python_utils/django/storage/tenant_aware_storage.py,sha256=5dDes6xLv7_R8hIBbFIzRvPL7HL9K_RM-G6LI8qUSxM,2550
63
63
  python_utils/django/tests/__init__.py,sha256=Nkt0a7LEHyjLvuEBZ7113VjjAWJlyZlMy-H-JZ5tNcs,252
64
64
  python_utils/django/tests/conftest.py,sha256=KozXmXUWVcDLbkVAb7Aq4sDydGLh2YZkbRa4tkA8Z6U,3167
65
- cardo_python_utils-0.5.dev47.dist-info/METADATA,sha256=x4oohC0B7kjPvZl0WnTVZKvxLnha3o3BUbnEPfDwpp4,3007
66
- cardo_python_utils-0.5.dev47.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
67
- cardo_python_utils-0.5.dev47.dist-info/top_level.txt,sha256=zAx6OfEsjJs8BEW3okSiG_j9gpkI69xWShzum6oBgKI,13
68
- cardo_python_utils-0.5.dev47.dist-info/RECORD,,
65
+ cardo_python_utils-0.5.dev48.dist-info/METADATA,sha256=EimWDluEjRNS_-U--n2S4C4jBu3Vx2nWS6PPnWeo3Ls,3007
66
+ cardo_python_utils-0.5.dev48.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
67
+ cardo_python_utils-0.5.dev48.dist-info/top_level.txt,sha256=zAx6OfEsjJs8BEW3okSiG_j9gpkI69xWShzum6oBgKI,13
68
+ cardo_python_utils-0.5.dev48.dist-info/RECORD,,
@@ -76,16 +76,16 @@ def get_confidential_client_service_account_token() -> str:
76
76
  """
77
77
  Reads the Keycloak confidential client service account token for the current tenant from a file.
78
78
  """
79
- tenant = TenantContext.get()
80
- token_file_path = KEYCLOAK_CONFIDENTIAL_CLIENT_SERVICE_ACCOUNT_TOKEN_FILE_PATHS.get(tenant)
79
+ realm = get_realm_for_tenant(TenantContext.get())
80
+ token_file_path = KEYCLOAK_CONFIDENTIAL_CLIENT_SERVICE_ACCOUNT_TOKEN_FILE_PATHS.get(realm)
81
81
  if not token_file_path or not os.path.isfile(token_file_path):
82
- raise FileNotFoundError(f"Keycloak service account token file for tenant {tenant} not found: {token_file_path}")
82
+ raise FileNotFoundError(f"Keycloak service account token file for tenant {realm} not found: {token_file_path}")
83
83
 
84
84
  with open(token_file_path, "r") as f:
85
85
  token = f.read().strip()
86
86
 
87
87
  if not token:
88
- raise ValueError(f"Keycloak service account token for tenant {tenant} is empty.")
88
+ raise ValueError(f"Keycloak service account token for tenant {realm} is empty.")
89
89
 
90
90
  return token
91
91
 
@@ -94,10 +94,10 @@ def get_confidential_client_secret() -> str:
94
94
  """
95
95
  Retrieves the Keycloak confidential client secret for the current tenant.
96
96
  """
97
- tenant = TenantContext.get()
98
- client_secret = KEYCLOAK_CONFIDENTIAL_CLIENT_SECRETS.get(tenant)
97
+ realm = get_realm_for_tenant(TenantContext.get())
98
+ client_secret = KEYCLOAK_CONFIDENTIAL_CLIENT_SECRETS.get(realm)
99
99
  if not client_secret:
100
- raise ValueError(f"Keycloak confidential client secret for tenant {tenant} not found.")
100
+ raise ValueError(f"Keycloak confidential client secret for tenant {realm} not found.")
101
101
 
102
102
  return client_secret
103
103