mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-27 01:45:32 +00:00
parent
2edf5ab6f9
commit
8e57b165a6
@ -11,7 +11,6 @@
|
|||||||
"""
|
"""
|
||||||
Interface definition for an Auth provider
|
Interface definition for an Auth provider
|
||||||
"""
|
"""
|
||||||
import http.client
|
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
@ -298,17 +297,20 @@ class Auth0AuthenticationProvider(AuthenticationProvider):
|
|||||||
return cls(config)
|
return cls(config)
|
||||||
|
|
||||||
def auth_token(self) -> None:
|
def auth_token(self) -> None:
|
||||||
conn = http.client.HTTPSConnection(self.security_config.domain)
|
|
||||||
payload = (
|
payload = (
|
||||||
f"grant_type=client_credentials&client_id={self.security_config.clientId}"
|
f"grant_type=client_credentials&client_id={self.security_config.clientId}"
|
||||||
f"&client_secret={self.security_config.secretKey.get_secret_value()}"
|
f"&client_secret={self.security_config.secretKey.get_secret_value()}"
|
||||||
f"&audience=https://{self.security_config.domain}/api/v2/"
|
f"&audience=https://{self.security_config.domain}/api/v2/"
|
||||||
)
|
)
|
||||||
headers = {"content-type": "application/x-www-form-urlencoded"}
|
headers = {"content-type": "application/x-www-form-urlencoded"}
|
||||||
conn.request(
|
res = requests.post(
|
||||||
"POST", f"/{self.security_config.domain}/oauth/token", payload, headers
|
url=f"https://{self.security_config.domain}/oauth/token",
|
||||||
|
data=payload,
|
||||||
|
headers=headers,
|
||||||
|
timeout=60 * 5,
|
||||||
)
|
)
|
||||||
res = conn.getresponse()
|
|
||||||
data = json.loads(res.read().decode("utf-8"))
|
data = json.loads(res.read().decode("utf-8"))
|
||||||
|
|
||||||
token = data.get(ACCESS_TOKEN)
|
token = data.get(ACCESS_TOKEN)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user