@@ -22,7 +22,8 @@ class from ``cognite.extractorutils.configtools`` your extractor will be configu
2222import logging
2323import time
2424from dataclasses import dataclass
25- from typing import Any , Dict
25+ from typing import Any , Dict , List
26+ from urllib .parse import urljoin
2627
2728import requests
2829
@@ -32,13 +33,14 @@ class from ``cognite.extractorutils.configtools`` your extractor will be configu
3233@dataclass
3334class AuthenticatorConfig :
3435 """
35- Configuration parameters for Azure AD
36+ Configuration parameters for an OIDC flow
3637 """
3738
3839 tenant : str
3940 client_id : str
40- scope : str
41+ scopes : List [ str ]
4142 secret : str
43+ authority : str = "https://login.microsoftonline.com/"
4244 min_ttl : float = 30 # minimum time to live: refresh token ahead of expiration
4345
4446
@@ -67,9 +69,11 @@ def _request(self) -> Dict[str, Any]:
6769 "tenant" : self ._config .tenant ,
6870 "client_secret" : self ._config .secret ,
6971 "grant_type" : "client_credentials" ,
70- "scope" : self ._config .scope ,
72+ "scope" : " " . join ( self ._config .scopes ) ,
7173 }
72- url = f"https://login.microsoftonline.com/{ self ._config .tenant } /oauth2/v2.0/token"
74+ base_url = urljoin (self ._config .authority , self ._config .tenant )
75+
76+ url = f"{ base_url } /oauth2/v2.0/token"
7377 r = requests .post (url , data = body )
7478 _logger .debug ("Request AAD token: %d %s" , r .status_code , r .reason )
7579 return r .json ()
0 commit comments