brynq-sdk-azure 3.0.1__tar.gz → 3.0.3__tar.gz

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: 1.0
2
2
  Name: brynq_sdk_azure
3
- Version: 3.0.1
3
+ Version: 3.0.3
4
4
  Summary: Azure wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -11,6 +11,7 @@ from msal import ConfidentialClientApplication
11
11
  from typing import Union, List, Literal, Optional
12
12
  import os
13
13
 
14
+
14
15
  class Entra(BrynQ):
15
16
 
16
17
  def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug: bool = False):
@@ -21,11 +22,11 @@ class Entra(BrynQ):
21
22
 
22
23
  def __get_headers(self, system_type):
23
24
  credentials = self.interfaces.credentials.get(system='azure-entra-o-auth-2', system_type=system_type)
24
- credentials = credentials.get('data')
25
+ credentials_data = credentials.get('data')
25
26
  if credentials.get("type") == 'custom':
26
- tenant_id = credentials['tenant_id']
27
- client_id = credentials['client_id']
28
- client_secret = credentials['client_secret']
27
+ tenant_id = credentials_data.get('tenant_id')
28
+ client_id = credentials_data.get('client_id')
29
+ client_secret = credentials_data.get('client_secret')
29
30
  authority = f"https://login.microsoftonline.com/{tenant_id}"
30
31
  # Create a ConfidentialClientApplication for authentication
31
32
  app = ConfidentialClientApplication(
@@ -38,7 +39,9 @@ class Entra(BrynQ):
38
39
  result = app.acquire_token_for_client(scopes=["https://graph.microsoft.com/.default"])
39
40
  access_token = result.get('access_token')
40
41
  elif credentials.get("type") == 'oauth2':
41
- access_token = credentials.get('access_token')
42
+ access_token = credentials_data.get('access_token')
43
+ else:
44
+ raise ValueError("The retrieved credentials are not part of the supported system types, please extend the SDK to support the specified type")
42
45
 
43
46
  headers = {
44
47
  'Authorization': f"Bearer {access_token}",
@@ -329,7 +332,7 @@ class Entra(BrynQ):
329
332
  return: response
330
333
  """
331
334
  url = f"https://graph.microsoft.com/v1.0/users/{user_id}/manager/$ref"
332
- content ={f"@odata.id": f"https://graph.microsoft.com/v1.0/users/{manager_id}"}
335
+ content = {f"@odata.id": f"https://graph.microsoft.com/v1.0/users/{manager_id}"}
333
336
  response = requests.put(url, headers=self.headers, data=json.dumps(content), timeout=self.timeout)
334
337
  return response
335
338
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq-sdk-azure
3
- Version: 3.0.1
3
+ Version: 3.0.3
4
4
  Summary: Azure wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name='brynq_sdk_azure',
5
- version='3.0.1',
5
+ version='3.0.3',
6
6
  description='Azure wrapper from BrynQ',
7
7
  long_description='Azure wrapper from BrynQ',
8
8
  author='BrynQ',