Skip to content

Commit

Permalink
Almost working tiled insertion and configuration for use with tiled a…
Browse files Browse the repository at this point in the history
…nd mock-oidc-server
  • Loading branch information
DiamondJoseph committed Jan 13, 2025
1 parent e9406e5 commit ad3ad9a
Show file tree
Hide file tree
Showing 7 changed files with 316 additions and 321 deletions.
4 changes: 3 additions & 1 deletion src/blueapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ class OIDCConfig(BlueapiBaseModel):
description="URL to fetch OIDC config from the provider"
)
client_id: str = Field(description="Client ID")
client_audience: str = Field(description="Client Audience(s)", default="blueapi")
client_audience: str | list[str] | None = Field(
description="Client Audience(s)", default="blueapi"
)

@cached_property
def _config_from_oidc_url(self) -> dict[str, Any]:
Expand Down
4 changes: 3 additions & 1 deletion src/blueapi/service/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def decode_jwt(self, json_web_token: str):
signing_key.key,
algorithms=self._server_config.id_token_signing_alg_values_supported,
verify=True,
audience=self._server_config.client_audience,
# audience=self._server_config.client_audience,
issuer=self._server_config.issuer,
)

Expand Down Expand Up @@ -169,6 +169,7 @@ def poll_for_token(
"grant_type": "urn:ietf:params:oauth:grant-type:device_code",
"device_code": device_code,
"client_id": self._server_config.client_id,
"client_secret": "secret",
},
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
Expand All @@ -184,6 +185,7 @@ def start_device_flow(self):
self._server_config.device_authorization_endpoint,
data={
"client_id": self._server_config.client_id,
"client_secret": "secret",
"scope": SCOPES,
},
headers={"Content-Type": "application/x-www-form-urlencoded"},
Expand Down
4 changes: 2 additions & 2 deletions src/blueapi/service/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ def clear_task(task_id: str) -> str:
return worker().clear_task(task_id)


def begin_task(task: WorkerTask) -> WorkerTask:
def begin_task(task: WorkerTask, token: str | None) -> WorkerTask:
"""Trigger a task. Will fail if the worker is busy"""
if task.task_id is not None:
worker().begin_task(task.task_id)
worker().begin_task(task.task_id, token=token)
return task


Expand Down
Loading

0 comments on commit ad3ad9a

Please sign in to comment.