We have reviewed the documentation for User-Restricted RESTful APIs, including both the NHS Login and CIS2 separate authentication and authorisation patterns, and would appreciate some clarification regarding A023.
From our understanding, A023 is a User-Restricted API and therefore requires authentication of an individual user, rather than only authentication of the calling application.
Our current solution architecture is an automated backend process:
SQL Agent Job → SSIS Package → C# Script Task → e-RS API
The process runs automatically on a schedule and does not involve:
A user interacting with the application
A browser session
NHS Login authentication
CIS2 smartcard authentication
CIS2 role selection
Having reviewed the User-Restricted API documentation, our understanding is that the following user authentication journey is required before an access token can be obtained:
Healthcare Worker → CIS2 Authentication → ID Token → OAuth Token Exchange → Access Token → User-Restricted API
Based on this, it appears that User-Restricted APIs are designed to operate within an authenticated user session and require a genuine healthcare worker or patient identity to be established before the API can be called.
Before we proceed further with the implementation, could you please clarify the expected approach for A023 in the context of an automated integration?
Specifically:
- Is CIS2 the recommended authentication mechanism for A023?
- Is A023 intended to be consumed only within an authenticated healthcare worker session?
- Is there a supported approach for automated/server-side integrations that do not involve interactive user authentication?
- If CIS2 is required, are Integration Test users or mock authentication services available for testing A023?
- Is A023 expected to be usable from a scheduled unattended process such as an SSIS package, or is it intended only for interactive healthcare worker applications?
Many thanks again for all your help and guidance.
Hello,
If an endpoint is only available via user-restricted authentication, then you are correct that it should be treated as such and accessed through a user-authenticated journey, including human interaction and CIS2 authentication.
Application-restricted endpoints are subject to additional controls, restrictions, and governance arrangements that are specific to that authentication model. Those safeguards would not necessarily be present if the same functionality were exposed through a user-restricted endpoint.
For that reason, where an endpoint is designated as user-restricted only, we would expect it to be consumed in that manner rather than attempting to replicate an application-restricted use case through a user-restricted integration.
Hi Tony,
Thank you for the clarification regarding A023 and the requirement for a user-authenticated journey using CIS2 authentication.
We understand that A023 is intended to be consumed by an authenticated healthcare worker rather than through an application-restricted integration.
To help us assess possible implementation options, could you please clarify how this is typically used in practice?
Our current integration is an automated SSIS/C# process that retrieves data on a scheduled basis.
Given the requirement for human interaction and CIS2 authentication for A023:
- Is access expected to occur only while a healthcare worker is actively signed in?
- Can the resulting access token and refresh token be used for a period after the initial CIS2 authentication?
- Is there a supported pattern where a healthcare worker authenticates once and the application continues to perform API calls for a limited time afterwards?
- Or is each A023 interaction expected to take place within an active user session?
We are trying to understand whether any level of automation is supported within the user-restricted model, while remaining fully compliant with the intended authentication requirements.
Many thanks for your guidance.
Thanks,
Rajan
Hi I’ve done some checking on the CIS guidance, I think this page is helpful
https://digital.nhs.uk/services/care-identity-service/applications-and-services/cis2-authentication/integrate/design-and-build/session-management
A023 is a user-restricted endpoint and is intended to be accessed on behalf of an authenticated healthcare worker using CIS2. The purpose of the user-restricted model is to ensure that e-RS can identify the individual user, apply the appropriate RBAC permissions and maintain an audit trail of activity.
In practice, this does not mean that the user must re-authenticate for every interaction. CIS2 establishes a user session once authentication has taken place, and that session can be reused in accordance with CIS2 session management rules. Current CIS2 guidance states that a CIS2 session may remain valid for up to 12 hours following authentication or re-authentication.
Therefore, I believe a pattern where a healthcare worker authenticates through CIS2 and the application subsequently performs A023 requests on behalf of that authenticated user within a valid session would align with the intended user-restricted model.
We would, however, expect the application to be operating within the context of an authenticated user and their permissions, rather than as a standalone system-to-system integration with no user context. I do appreciate that in line with our other endpoints, it would be more ideal for this one to be application restricted in allowed auth pattern, but until we get there, we should not treat it as such.
@Adrian_Hall Would you concur with this response from a CIS perspective?
That seems to align with the CIS view.
The API-M token received in the token exchange from the CIS2 Auth ID Token is only valid for use whilst that user is still present and controlling the application.
You must not keep that token if the user is logged out of the application, either deliberately, or via inactivity timeout, or via CIS2 back channel logout.
It’s user restricted mode and requires a user present to use it.