openstax / sso-cookie-decoder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SSO Cookie Decoder

This project contains a Lambda@Edge function that decodes the OpenStax Accounts JWT signed cookie and sets custom HTTP headers based on its content. This is useful for applications behind a CloudFront distribution that wish to make decisions based on JWT claims without having to decode the JWT on every server or application instance.

If a openstax SSO cookie is present on a request, it will set two headers:

  • os-user-uuid: The user's uuid
  • os-user: JSON encoded content of the accounts cookie

Table of Contents

Requirements

  • AWS Account with permissions to create Lambda functions and CloudFront distributions.
  • node.js and npm installed.
  • Nodejs 20+

Installation

  1. Clone this repository:

    git clone https://github.com/openstax/sso-cookie-decoder.git
    cd sso-cookie-decoder
  2. Install dependencies:

    yarn install
  3. Make changes and run tests

    yarn test
  4. Set terraform config vars in your environment

    . ./set-env <staging|production>

Note: Make sure you have AWS credentials set using the OpenStax set_aws_creds script

  1. run terraform
    terraform apply

About

License:GNU Affero General Public License v3.0


Languages

Language:TypeScript 85.7%Language:HCL 11.7%Language:Shell 1.8%Language:JavaScript 0.8%