Skip to content

← All contracts

OHN-38 Authentication and Identity Federation

Version
1.1.0
OpenAPI
3.1.0
Source in the repository
modules/OHN-38/api/openapi.yaml
Servers
https://opeshealthnetwork.com
Authentication
bearerAuth: http bearer (JWT)

Download the contract (YAML)

Contracts are written in English.

Reconciled with the observed behaviour of the TypeScript reference (backend/modules/ohn-38), see docs/program/java/ohn-38-contract-changes.md. Administration routes need a gateway token with role security_administrator or identity_admin (default deny); login, token exchange, introspection and OIDC discovery are public.

Operations

ohn38

GET/.well-known/openid-configuration

Static OIDC metadata. Answers 503 not_configured when the issuer is not configured. Never contains keys or secrets.

Operation ID: ohn38_discovery

Responses

CodeDescriptionMedia type
200OIDC metadata
application/json: object
503Not configured or dependency unavailable; nothing was done—
GET/health/ohn-38

Public liveness probe (Java only; the reference has none). 200 {status, module} when the database answers, 503 otherwise.

Operation ID: ohn38_health

Responses

CodeDescriptionMedia type
200ok
application/json: object
503unavailable
application/json: object
POST/api/ohn/v1/authenticators/enroll

Creates an authenticator and returns its provisioning secret ONCE (never readable afterwards). A re-enrolment supersedes every earlier TOTP secret of the principal.

Operation ID: ohn38_enrollAuthenticator

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Enrolled (id, principal_id, factor_type, provisioning_secret, otpauth_url, receipt)
application/json: object
401Authentication failed without credential enumeration—
403Default-deny policy refusal—
422Field/domain validation failed (domain_validation_failed)—
POST/api/ohn/v1/auth/login

Public. TOTP sign-in. A code is accepted once. After the configured number of failed codes inside the window the principal is locked (423, Retry-After) and even a correct code is refused. A malformed lockout configuration answers 503.

Operation ID: ohn38_login

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200MFA-backed session (access_token, token_type, session_id, expires_in)
application/json: object
401authentication_failed with risk_ref (no credential enumeration)
application/json: object
422Field/domain validation failed (domain_validation_failed)—
423account_locked (Retry-After, retry_after_seconds, risk_ref)
application/json: object
429Retry after the rate-limit window—
503Not configured or dependency unavailable; nothing was done—
POST/api/ohn/v1/sessions/introspect

Public. The signature, issuer, audience and expiry are checked, then the stored session must exist with the same token hash, unrevoked and unexpired.

Operation ID: ohn38_introspectSession

Parameters

NameInTypeRequiredDescription
X-Device-AttestationheaderstringnoThe device the session is bound to (UUID). A missing or different value answers 403 device_binding_mismatch.

Request body (required)

Responses

CodeDescriptionMedia type
200Active session (active, session_id, principal_id, expires_at)
application/json: object
401{active:false}
application/json: object
403{active:false, reason:device_binding_mismatch}
application/json: object
422Field/domain validation failed (domain_validation_failed)—
GET/api/ohn/v1/sessions

Sessions, enrollments (no secrets), trusts, clients (no secrets), role bindings, revocations and workflow history of the caller's jurisdiction and organization, with a summary and provenance.

Operation ID: ohn38_listIdentityState

Authentication: bearerAuth

Responses

CodeDescriptionMedia type
200Scoped identity state
application/json: object
403Default-deny policy refusal—
POST/api/ohn/v1/sessions/revoke

Revokes the listed sessions of the caller's jurisdiction and organization immediately and opens the privilege_revocation workflow at token_invalidated (version 2).

Operation ID: ohn38_revokeSessions

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Revoked immediately (id, workflow_id, state, revoked_count, receipt)
application/json: object
409Idempotency or optimistic concurrency conflict—
422Field/domain validation failed (domain_validation_failed)—
POST/api/ohn/v1/identity-federation/trusts

Records an HTTPS issuer trust for the caller's own jurisdiction (a different jurisdiction_id is 403). A second trust for the same issuer is 409 conflict.

Operation ID: ohn38_configureTrust

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Trust configured (id, issuer_url, status, key_rotation_at, receipt)
application/json: object
403Default-deny policy refusal—
409Idempotency or optimistic concurrency conflict—
422Field/domain validation failed (domain_validation_failed)—
POST/api/ohn/v1/privileged-role-bindings

Operation ID: ohn38_bindRole

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Expiring role binding created (id, role, expires_at, receipt)
application/json: object
403Default-deny policy refusal—
422Field/domain validation failed (domain_validation_failed)—
POST/api/ohn/v1/oauth/clients

Operation ID: ohn38_onboardClient

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Client attested (id, client_id, state, version, receipt)
application/json: object
422Field/domain validation failed (domain_validation_failed)—
POST/api/ohn/v1/oauth/clients/{id}/transitions

Same handler as /workflows/{id}/transitions (the reference accepts either route for a client or a revocation).

Operation ID: ohn38_transitionClient

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
idpathstringyesUUID of the client or revocation; anything else is 404
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Guarded transition committed (id, state, version, client_secret ONCE when credential_issued, receipt)
application/json: object
404Non-disclosing not found—
409Idempotency or optimistic concurrency conflict—
422Field/domain validation failed (domain_validation_failed)—
POST/api/ohn/v1/workflows/{id}/transitions

Workflow service_principal_onboarding: client_attested, workflow_identity_bound, scope_approved, credential_issued (the secret is returned once). Workflow privilege_revocation: token_invalidated, sessions_terminated, audit_recorded. Only the next state is allowed; expected_version must match (409 stale_version, 422 invalid_transition).

Operation ID: ohn38_transitionWorkflow

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
idpathstringyesUUID of the client or revocation; anything else is 404
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Guarded transition committed
application/json: object
404Non-disclosing not found—
409Idempotency or optimistic concurrency conflict—
422Field/domain validation failed (domain_validation_failed)—
POST/api/ohn/v1/oauth/token

Public. client_credentials exchange (JSON body). grant_type is optional but any value other than client_credentials is 422. Every failure is 401 invalid_client.

Operation ID: ohn38_exchangeToken

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
200Service session (access_token, token_type, expires_in, scope, session_id)
application/json: object
401Authentication failed without credential enumeration—
422Field/domain validation failed (domain_validation_failed)—
429Retry after the rate-limit window—
503Not configured or dependency unavailable; nothing was done—
GET/api/ohn/v1/reports/{id}

Operation ID: ohn38_getReport

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
idpathstringyesOHN-38-R001, OHN-38-R002 or OHN-38-R003; any other value is 404

Responses

CodeDescriptionMedia type
200Scoped report with metrics and provenance
application/json: object
404Non-disclosing not found—
POST/api/ohn/v1/reports/{id}/export

HMAC-SHA256 signed content (base64) with five-minute expiry metadata and an audit receipt. Answers 503 not_configured when the export signing key is not configured.

Operation ID: ohn38_exportReport

Authentication: bearerAuth

Parameters

NameInTypeRequiredDescription
idpathstringyes
Idempotency-Keyheaderstringyes

Request body (required)

Responses

CodeDescriptionMedia type
201Signed content
application/json: object
403Default-deny policy refusal—
404Non-disclosing not found—
422Field/domain validation failed (domain_validation_failed)—
503Not configured or dependency unavailable; nothing was done—

Schemas

EnrollmentCommand

NameTypeRequiredDescription
principal_idstring (uuid)yes
factor_type"totp" | "passkey"yespasskey needs device_attestation; only totp can sign in
device_attestationstring (uuid)no
verification_proofstring (uuid)yes
recovery_method"identity_proofing" | "dual_control" | "recovery_codes"yes

SessionRevocationCommand

NameTypeRequiredDescription
principal_idstring (uuid)yes
session_idsstringyesOne session UUID per line
reasonstringyes
effective_atstring (date-time)yes

FederationTrustCommand

NameTypeRequiredDescription
issuer_urlstringyesAn https URL
client_registration_refstring (uuid)yes
signing_key_refstring (uuid)yes
allowed_audiencesstringyesOne audience per line, unique
jurisdiction_idstring (uuid)yes

RoleBindingCommand

NameTypeRequiredDescription
principal_idstring (uuid)yes
role"security_administrator" | "identity_admin" | "clinician" | "patient" | "technical_client" | "pharmacist" | "lab_technologist" | "radiologist" | "claims_adjudicator" | "partner_staff" | "integration_developer"yes
organization_idstring (uuid)yes
approval_refstring (uuid)yes
expires_atstring (date-time)yesMust be in the future

LoginCommand

NameTypeRequiredDescription
principal_idstring (uuid)yes
otpstringyes
device_attestationstring (uuid)yes

IntrospectionCommand

NameTypeRequiredDescription
tokenstringyes

OAuthClientCommand

NameTypeRequiredDescription
attestation_refstring (uuid)yes
allowed_scopesstringyesOne scope per line

WorkflowCommand

NameTypeRequiredDescription
expected_versionintegeryes
to_statestringyes
evidence_refstring (uuid)yes
reasonstringyes

TokenExchangeCommand

NameTypeRequiredDescription
grant_typestringnoOptional; only client_credentials is accepted
client_idstring (uuid)yes
client_secretstringyes
scopestringyesSpace separated scopes; all must be allowed for the client

ExportCommand

NameTypeRequiredDescription
format"csv" | "pdf"yes