package
2.32.0
Repository: https://github.com/onsdigital/dp-authorisation.git
Documentation: pkg.go.dev

# README

JWT

The JWT package provides functions to parse a JWT token and extract entity data from it.

Usage

Create a new instance of a JWT parser

  import (
    "github.com/ONSdigital/dp-authorisation/v2/jwt"
    "github.com/ONSdigital/dp-authorisation/v2/permissions"
  )
  
  ...

  p, err := jwt.NewCognitoRSAParser(publicKey)

The public key value should come from the service configuration. The NewCognitoRSAParser is tailored for JWT tokens generated by AWS Cognito. These tokens use RSA encryption for token verification, and have Cognito specific claims. Other Parser implementations can be used, as long as they implement the generic parse function.

Parse(tokenString string) (*permsdk.EntityData, error)

Parse a JWT token

entityData, err := p.Parse(jwtToken)

# Functions

NewCognitoRSAParser creates a new instance of CognitoRSAParser using the given public key value.

# Constants

No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
more generic error to catch any other cases.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

CognitoRSAParser parses JWT tokens that have an RSA encrypted signature, and contain AWS cognito specific claims.