Skip to content

Commit

Permalink
Add Infinity initialization through direct client id and secret
Browse files Browse the repository at this point in the history
  • Loading branch information
StijnKas committed Feb 6, 2025
1 parent b817f63 commit 08298e5
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions python/pdstools/infinity/internal/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,29 @@ def _get_version(self, repo):
)
return "Undefined"

@classmethod
def from_client_id_and_secret(
cls,
base_url: str,
client_id: str,
client_secret: str,
verify: bool = False,
pega_version: Optional[str] = None,
timeout: float = 90,
):
return cls(
base_url=base_url,
auth=PegaOAuth(
base_url,
client_id=client_id,
client_secret=client_secret,
verify=verify,
),
verify=verify,
pega_version=pega_version,
timeout=timeout,
)

@classmethod
def from_client_credentials(
cls,
Expand All @@ -122,14 +145,10 @@ def from_client_credentials(
creds = _read_client_credential_file(file_path)
base_url = creds["Access token endpoint"].rsplit("/prweb")[0]

return cls(
return cls.from_client_id_and_secret(
base_url=base_url,
auth=PegaOAuth(
base_url,
creds["Client ID"],
client_secret=creds["Client Secret"],
verify=verify,
),
client_id=creds["Client ID"],
client_secret=creds["Client Secret"],
verify=verify,
pega_version=pega_version,
timeout=timeout,
Expand Down

0 comments on commit 08298e5

Please sign in to comment.