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)
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 (15)
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
| Code | Description | Media type |
|---|---|---|
200 | OIDC metadata | application/json: object |
503 | Not 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
| Code | Description | Media type |
|---|---|---|
200 | ok | application/json: object |
503 | unavailable | 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:EnrollmentCommand
Responses
| Code | Description | Media type |
|---|---|---|
201 | Enrolled (id, principal_id, factor_type, provisioning_secret, otpauth_url, receipt) | application/json: object |
401 | Authentication failed without credential enumeration | — |
403 | Default-deny policy refusal | — |
422 | Field/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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:LoginCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | MFA-backed session (access_token, token_type, session_id, expires_in) | application/json: object |
401 | authentication_failed with risk_ref (no credential enumeration) | application/json: object |
422 | Field/domain validation failed (domain_validation_failed) | — |
423 | account_locked (Retry-After, retry_after_seconds, risk_ref) | application/json: object |
429 | Retry after the rate-limit window | — |
503 | Not 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Device-Attestation | header | string | no | The device the session is bound to (UUID). A missing or different value answers 403 device_binding_mismatch. |
Request body (required)
application/json:IntrospectionCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | Active 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 |
422 | Field/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
| Code | Description | Media type |
|---|---|---|
200 | Scoped identity state | application/json: object |
403 | Default-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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:SessionRevocationCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | Revoked immediately (id, workflow_id, state, revoked_count, receipt) | application/json: object |
409 | Idempotency or optimistic concurrency conflict | — |
422 | Field/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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:FederationTrustCommand
Responses
| Code | Description | Media type |
|---|---|---|
201 | Trust configured (id, issuer_url, status, key_rotation_at, receipt) | application/json: object |
403 | Default-deny policy refusal | — |
409 | Idempotency or optimistic concurrency conflict | — |
422 | Field/domain validation failed (domain_validation_failed) | — |
POST/api/ohn/v1/privileged-role-bindings
Operation ID: ohn38_bindRole
Authentication: bearerAuth
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:RoleBindingCommand
Responses
| Code | Description | Media type |
|---|---|---|
201 | Expiring role binding created (id, role, expires_at, receipt) | application/json: object |
403 | Default-deny policy refusal | — |
422 | Field/domain validation failed (domain_validation_failed) | — |
POST/api/ohn/v1/oauth/clients
Operation ID: ohn38_onboardClient
Authentication: bearerAuth
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:OAuthClientCommand
Responses
| Code | Description | Media type |
|---|---|---|
201 | Client attested (id, client_id, state, version, receipt) | application/json: object |
422 | Field/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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | UUID of the client or revocation; anything else is 404 |
Idempotency-Key | header | string | yes |
Request body (required)
application/json:WorkflowCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | Guarded transition committed (id, state, version, client_secret ONCE when credential_issued, receipt) | application/json: object |
404 | Non-disclosing not found | — |
409 | Idempotency or optimistic concurrency conflict | — |
422 | Field/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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | UUID of the client or revocation; anything else is 404 |
Idempotency-Key | header | string | yes |
Request body (required)
application/json:WorkflowCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | Guarded transition committed | application/json: object |
404 | Non-disclosing not found | — |
409 | Idempotency or optimistic concurrency conflict | — |
422 | Field/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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes |
Request body (required)
application/json:TokenExchangeCommand
Responses
| Code | Description | Media type |
|---|---|---|
200 | Service session (access_token, token_type, expires_in, scope, session_id) | application/json: object |
401 | Authentication failed without credential enumeration | — |
422 | Field/domain validation failed (domain_validation_failed) | — |
429 | Retry after the rate-limit window | — |
503 | Not configured or dependency unavailable; nothing was done | — |
GET/api/ohn/v1/reports/{id}
Operation ID: ohn38_getReport
Authentication: bearerAuth
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | OHN-38-R001, OHN-38-R002 or OHN-38-R003; any other value is 404 |
Responses
| Code | Description | Media type |
|---|---|---|
200 | Scoped report with metrics and provenance | application/json: object |
404 | Non-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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | |
Idempotency-Key | header | string | yes |
Request body (required)
application/json:ExportCommand
Responses
| Code | Description | Media type |
|---|---|---|
201 | Signed content | application/json: object |
403 | Default-deny policy refusal | — |
404 | Non-disclosing not found | — |
422 | Field/domain validation failed (domain_validation_failed) | — |
503 | Not configured or dependency unavailable; nothing was done | — |
Schemas
EnrollmentCommand
| Name | Type | Required | Description |
|---|---|---|---|
principal_id | string (uuid) | yes | |
factor_type | "totp" | "passkey" | yes | passkey needs device_attestation; only totp can sign in |
device_attestation | string (uuid) | no | |
verification_proof | string (uuid) | yes | |
recovery_method | "identity_proofing" | "dual_control" | "recovery_codes" | yes |
SessionRevocationCommand
| Name | Type | Required | Description |
|---|---|---|---|
principal_id | string (uuid) | yes | |
session_ids | string | yes | One session UUID per line |
reason | string | yes | |
effective_at | string (date-time) | yes |
FederationTrustCommand
| Name | Type | Required | Description |
|---|---|---|---|
issuer_url | string | yes | An https URL |
client_registration_ref | string (uuid) | yes | |
signing_key_ref | string (uuid) | yes | |
allowed_audiences | string | yes | One audience per line, unique |
jurisdiction_id | string (uuid) | yes |
RoleBindingCommand
| Name | Type | Required | Description |
|---|---|---|---|
principal_id | string (uuid) | yes | |
role | "security_administrator" | "identity_admin" | "clinician" | "patient" | "technical_client" | "pharmacist" | "lab_technologist" | "radiologist" | "claims_adjudicator" | "partner_staff" | "integration_developer" | yes | |
organization_id | string (uuid) | yes | |
approval_ref | string (uuid) | yes | |
expires_at | string (date-time) | yes | Must be in the future |
LoginCommand
| Name | Type | Required | Description |
|---|---|---|---|
principal_id | string (uuid) | yes | |
otp | string | yes | |
device_attestation | string (uuid) | yes |
IntrospectionCommand
| Name | Type | Required | Description |
|---|---|---|---|
token | string | yes |
OAuthClientCommand
| Name | Type | Required | Description |
|---|---|---|---|
attestation_ref | string (uuid) | yes | |
allowed_scopes | string | yes | One scope per line |
WorkflowCommand
| Name | Type | Required | Description |
|---|---|---|---|
expected_version | integer | yes | |
to_state | string | yes | |
evidence_ref | string (uuid) | yes | |
reason | string | yes |
TokenExchangeCommand
| Name | Type | Required | Description |
|---|---|---|---|
grant_type | string | no | Optional; only client_credentials is accepted |
client_id | string (uuid) | yes | |
client_secret | string | yes | |
scope | string | yes | Space separated scopes; all must be allowed for the client |
ExportCommand
| Name | Type | Required | Description |
|---|---|---|---|
format | "csv" | "pdf" | yes |