brynq-sdk-azure 3.0.0__tar.gz → 3.0.2__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.
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/PKG-INFO +1 -1
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure/entra.py +23 -16
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure.egg-info/PKG-INFO +1 -1
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/setup.py +1 -1
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure/__init__.py +0 -0
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure/azure_connection.py +0 -0
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure/blob_storage.py +0 -0
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure.egg-info/not-zip-safe +0 -0
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure.egg-info/requires.txt +0 -0
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure.egg-info/top_level.txt +0 -0
- {brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/setup.cfg +0 -0
|
@@ -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):
|
|
@@ -20,24 +21,30 @@ class Entra(BrynQ):
|
|
|
20
21
|
self.timeout = 3600
|
|
21
22
|
|
|
22
23
|
def __get_headers(self, system_type):
|
|
23
|
-
credentials = self.interfaces.credentials.get(system='azure-entra-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
credentials = self.interfaces.credentials.get(system='azure-entra-o-auth-2', system_type=system_type)
|
|
25
|
+
credentials_data = credentials.get('data')
|
|
26
|
+
if credentials.get("type") == 'custom':
|
|
27
|
+
tenant_id = credentials_data.get('tenant_id')
|
|
28
|
+
client_id = credentials.get('client_id')
|
|
29
|
+
client_secret = credentials.get('client_secret')
|
|
30
|
+
authority = f"https://login.microsoftonline.com/{tenant_id}"
|
|
31
|
+
# Create a ConfidentialClientApplication for authentication
|
|
32
|
+
app = ConfidentialClientApplication(
|
|
33
|
+
client_id,
|
|
34
|
+
authority=authority,
|
|
35
|
+
client_credential=client_secret,
|
|
36
|
+
)
|
|
29
37
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
# Get an access token for the Graph API
|
|
39
|
+
result = app.acquire_token_for_client(scopes=["https://graph.microsoft.com/.default"])
|
|
40
|
+
access_token = result.get('access_token')
|
|
41
|
+
elif credentials.get("type") == 'oauth2':
|
|
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")
|
|
36
45
|
|
|
37
|
-
# Get an access token for the Graph API
|
|
38
|
-
result = app.acquire_token_for_client(scopes=["https://graph.microsoft.com/.default"])
|
|
39
46
|
headers = {
|
|
40
|
-
'Authorization': f"Bearer {
|
|
47
|
+
'Authorization': f"Bearer {access_token}",
|
|
41
48
|
'Content-Type': 'application/json'
|
|
42
49
|
}
|
|
43
50
|
|
|
@@ -325,7 +332,7 @@ class Entra(BrynQ):
|
|
|
325
332
|
return: response
|
|
326
333
|
"""
|
|
327
334
|
url = f"https://graph.microsoft.com/v1.0/users/{user_id}/manager/$ref"
|
|
328
|
-
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}"}
|
|
329
336
|
response = requests.put(url, headers=self.headers, data=json.dumps(content), timeout=self.timeout)
|
|
330
337
|
return response
|
|
331
338
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_azure-3.0.0 → brynq_sdk_azure-3.0.2}/brynq_sdk_azure.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|