Add JWT login support

This commit is contained in:
Cyber MacGeddon 2026-04-23 13:47:49 +01:00
parent 0ca0f9999c
commit 7be781b6e2
2 changed files with 210 additions and 1 deletions

View file

@ -112,6 +112,29 @@ class IamClient(RequestResponse):
timeout=timeout,
)
async def login(self, username, password, workspace="",
timeout=IAM_TIMEOUT):
"""Validate credentials and return ``(jwt, expires_iso)``.
``workspace`` is optional; defaults at the server to the
OSS default workspace."""
resp = await self._request(
operation="login",
workspace=workspace,
username=username,
password=password,
timeout=timeout,
)
return resp.jwt, resp.jwt_expires
async def get_signing_key_public(self, timeout=IAM_TIMEOUT):
"""Return the active JWT signing public key in PEM. The
gateway calls this at startup and caches the result."""
resp = await self._request(
operation="get-signing-key-public",
timeout=timeout,
)
return resp.signing_key_public
class IamClientSpec(RequestResponseSpec):
def __init__(self, request_name, response_name):