OCDocker.Workbench.Auth module

Bearer-token resolution for execute-capable Workbench API endpoints (/api/jobs*). The token is read from OCDOCKER_WORKBENCH_TOKEN or ~/.config/ocdocker/workbench_token, generating the latter on first use.

Bearer-token authentication for execute-capable Workbench API endpoints.

OCDocker.Workbench.Auth.resolve_workbench_job_token(*, create=True)[source]

Resolve the bearer token that gates Workbench job-execute endpoints.

Resolution order: the OCDOCKER_WORKBENCH_TOKEN environment variable, then the token file, then (when create is True) a freshly generated token persisted to the token file.

Parameters:

create (bool) – Generate and persist a new token when none is configured yet.

Returns:

Resolved bearer token.

Return type:

str

Raises:

FileNotFoundError – If no token is configured and create is False.

OCDocker.Workbench.Auth.workbench_job_token_path()[source]

Return the on-disk path used to persist the Workbench job token.

Returns:

Workbench job token file path.

Return type:

pathlib.Path