Skip to content

Authorise dicom API requests by Gateway OID#1395

Open
steventux wants to merge 7 commits intomainfrom
feat/authorise-dicom-api-requests
Open

Authorise dicom API requests by Gateway OID#1395
steventux wants to merge 7 commits intomainfrom
feat/authorise-dicom-api-requests

Conversation

@steventux
Copy link
Copy Markdown
Contributor

Description

In order to know that the dicom API file upload is valid for the given source message ID we authenticate a JWT generated via the deployed gateway app's system assigned managed identity.
The oid claim in the token should match the oid on a Gateway record in Manage.
We check that the GatewayAction with a pk matching the API request's source_message_id is associated to a Gateway with the same oid as presented in the token.

Jira link

https://nhsd-jira.digital.nhs.uk/browse/DTOSS-12648

Review notes

Review checklist

  • Check database queries are correctly scoped to current_provider
  • If this changes the gateway API (/api/v1/), confirm whether it is a breaking change — if so, a new major version (/api/v2/) is required (see ADR-006)

The oid is stored against Gateway records, the source_message_id is the primary key of the GatewayAction which sends the appointment worklist item to the gateway. The relationship between the two ensures any API calls from a gateway can only operate on appointments associated with the appropriate GatewayAction record.
We will need to examine the oid claim in this object.
Allow local development without oid auth claims.
@sonarqubecloud
Copy link
Copy Markdown

GatewayActionFactory(
id=source_message_id,
gateway=GatewayFactory(oid=oid),
created_at=date.today(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth using timezone.now().date() in this file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants