Git Product home page Git Product logo

nhslogin's Introduction

What is NHS login?

NHS login is a new way for people to prove who they are online, so they can access health and care websites or apps safely and securely.

By integrating NHS login to your website or app you can offer users self-service access. You can also choose the level and combination of verification and authentication required for user access.

NHS login is based on OpenID Connect (OIDC), which is an open standard. You can find out more about our use of OIDC by reading the external interface specification (EIS).

The OIDC login flow

Overview

The goal of the OIDC authorization code flow is for the relying party (your service) to obtain an ID Token from the OIDC provider (NHS login). The ID Token contains identifying information about the user (claims), such as family name, date of birth, and NHS number. Further claims can be obtained via the userinfo endpoint. The claims returned are based on the scopes specified in the original auth request - see table 11 of the EIS for more information. The ID Token also contains information about authentication mechanisms used and the level to which a user’s identity has been verified - these are called vectors of trust, see the EIS for more information.

Initiating Authorization Flow

The first step involves the client sending a request to NHS login with the desired parameters (example included here). These include your identifying information, such as client_id, and scopes, which will ultimately determine the returned claims.

Completing Authorization Flow

NHS login will return an authorization code, which you then use to obtain the ID Token. This is done by making a request to the NHS login token endpoint. The token endpoint requires authentication via private_key_jwt method. The returned ID Token must be validated before it can be used within your service.

How can I test NHS login in my service?

We have a stub and a sandpit that development teams can use to familiarise themselves with NHS login.

NHS login stub

We have developed a lightweight stub that is a representation of our OIDC endpoints. You can find out more about the stub and access it here: https://stub.signin.nhs.uk/client. The stub is entirely self-service and requires no registration.

Sandpit

Our sandpit is a deployment of much of the production code, with some elements of the registration process removed e.g. matching to NHS number and checking ID documents.

How do I integrate to the sandpit?

We’ll need to setup your service on NHS login sandpit. Please provide the below information to [email protected]

Required information:

  • A friendly name of your service e.g. what the public know you as

  • Your redirect_uri that we’ll return traffic to

  • Your public key for validating signed JWTs - see below for guidance on generating this

We aim to process these requests within 24 hours.

You will need to add an OIDC Relying Party library to your service. OpenID certified examples can be found here: https://openid.net/developers/certified/

We have provided links to a couple of example repos at the bottom of this file. We aim to add more client examples over the coming months. If you have one to add, please raise an issue or PR.

Depending on the library you pick you’ll either need:

Testing the login flow in the Sandpit

Before testing the registration flow you should ensure a login flow can be completed. This involves all of the interaction points, such as the token and userinfo endpoints.

There are a number of users already configured that you can use to test the login flow. We'll send you the test pack when we configure your client.

Testing the registration process

We currently have two methods to complete registration:

  • Existing GP Online details
  • Online ID check with video selfie

We do not support testing of GP Online method in the sandpit, but you can test the online ID checking process.

When registering a new user you will need to provide a unique email address (using the + trick in emails can help if you want to test a number of times). You can reuse your mobile number for multiple users.

Do not use any other personal information when completing registration. This includes NHS number and ID photo - take a picture of anything you like, within reason!

We don’t tend to approve new registrations in this environment. If you need us to do this please get in touch via slack - see below for joining info.

Technical Conformance

IM1 Suppliers

IM1 Suppliers have the option to test either the GP online or Prove your identity journey in the Integration Environment.

  • NHS login provide a set of patient records that exist on the Spine Integration Environment which IM1 suppliers can use
  • IM1 suppliers should create new records in their local GP system based on the patient details provided by NHS login
  • IM1 suppliers should then create linkage key, account ID and ODS code details against the records created in the local GP system. These details should then be shared with NHS login
  • IM1 suppliers should also create new NHS login accounts by registering with an email and password
  • NHS login will update the linkage key, account ID, ODS code and IM1 token in the NAM Stub
  • IM1 supplier should be able to login successfully and proceed through either the GP Online or Prove your identity journey.
  • Once submitted suppliers should notify NHS login to approve the requests
  • IM1 supplier should be able to login successfully and be redirect to respected service with patient record which exists in the local GP system

Non-IM1 Suppliers

Non-IM1 suppliers can choose to use the basic patient records provided to proceed through the Prove your identity journey. Non-IM1 suppliers now also have the abiliy to test the GP online journey by using details from the NAM Stub.

  • NHS login provide a set of patient records that exist in the NAM Stub, the details include Linkage Key, account ID and ODS code
  • Non-IM1 suppliers can create new NHS login accounts and proceed through the GP Online Journey by providing valid details from the NAM Stub
  • NHS login accounts verified against the NAM Stub are successfully redirected to the respected service

Testing FIDO UAF flow

Please get in touch if you'd like to add FIDO UAF (TouchID etc.) to your app.

Developer support

We have a public slack where you can contact us for support.

Guidance for generating asymmetric key pair

You will need to provide a public key when registering your service. This is required for the authentication mechanism on the token endpoint. The steps below explain how to generate that public key and corresponding private key.

Full details can be found here: https://en.wikibooks.org/wiki/Cryptography/Generate_a_keypair_using_OpenSSL

Generate private_key.pem:

openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt  
rsa_keygen_bits:2048

Generate corresponding public_key.pem:

openssl rsa -pubout -in private_key.pem -out public_key.pem

You should now have your key pair. Only send the contents of public_key.pem file when requesting access to a new environment.

Adding the NHS login button to your service

The NHS login button is available as a downloadable package.

You must follow the NHS login button guidelines.

Linking your service to our NHS login settings page

NHS login provides capability for users to change their NHS login settings online, helping to reduce calls into your support desks. To help users do this, NHS login needs you to create a link from your service to the NHS login settings page. Users will need to be logged into your service to use this link.

Use the NHS login Link to Settings Page presentation for guidance on this.

Using NHS login to create or retrieve GP credentials

If you are an IM1 supplier, learn how to use NHS login to create or retrieve GP credentials. These include an Account ID, ODS Code and Linkage Key. This means users do not have to go their GP practice to register for your service.

Use the NHS login GPIC presentation for guidance on this.

Example OIDC clients used for NHS login

NHS login Developer's Docs

A place to reference, use and contribute to.

A quick reference guide:

How to add your own pages, files and contrbutions to this document and a few basics tips on styling.

Viewing documents

To view the official NHS login documentation page, click here.

This would be best for those of you who are viewing documentation and would like to view it in an easily navigatable format.

Navigating these files

  1. Click on the src file
  2. Find the file that you would like to view and click into it.

Editing or Adding documents

This would be best for those of you wishing to edit or add your own contributions to these documents.

  1. Click on the src file
  2. Find the file that you would like to edit and click into it.
  3. Click the "Edit" icon button at the top right of the page.
  4. When you are finished making your changes, click Commit at the bottom of the page.

Creating a new page

  1. Click on the src file
  2. Click the "Create new file" button at the top right of the page
  3. Give your file an appropriate name, making sure to end this name with .md
  4. When you are finished making your changes, click Commit at the bottom of the page.

Before you start writing

  1. Make sure before you begin writing your document, that you copy and paste the following block of text to the very top of your document.

  2. Make sure that where it states "Your title", you change it to whatever you would like your title to be.

---
layout: base.njk
title: Your title
---

Making sure your document contains this at the very top means that your contribution will automatically use the NHS login Docs theme.

Editing an existing page

-When you click on the file, there should be an edit button in the top right of the document

-When you're finished with your changes, make sure you click Commit changes

-Or click Cancel if you wish to discard your changes

Adding links

When adding links, the correct format is as follows:

[Name of link](www.linkgoeshere.com)

Basic Text Styling Tips

Style How To
Heading ## Two hashes before text
Bold ** Double asterix around text **
Italics * Single asterix around text *
List - Before each item
Numbered list 1. 2. 3. etc. Before each item

nhslogin's People

Contributors

monsterlimo avatar lydiateebay avatar darrenhutton avatar hs14m2b avatar faithmawi avatar jamiecurnow avatar mattfielding avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.