{"id":22802741,"url":"https://github.com/buffolander/assessment-auth-middleware","last_synced_at":"2026-03-19T23:43:37.522Z","repository":{"id":143741827,"uuid":"424436764","full_name":"buffolander/assessment-auth-middleware","owner":"buffolander","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-04T13:31:25.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-05T22:59:35.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buffolander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-04T01:37:52.000Z","updated_at":"2023-03-05T07:58:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"2423acbe-5f0d-4f8e-8a98-3a0832ef4ff1","html_url":"https://github.com/buffolander/assessment-auth-middleware","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buffolander%2Fassessment-auth-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buffolander%2Fassessment-auth-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buffolander%2Fassessment-auth-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buffolander%2Fassessment-auth-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buffolander","download_url":"https://codeload.github.com/buffolander/assessment-auth-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246372746,"owners_count":20766635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-12T09:07:10.608Z","updated_at":"2026-01-11T02:15:18.139Z","avatar_url":"https://github.com/buffolander.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Collective Benefits Tech Assessment\n\nOur platform is comprised of a set of single-page web applications interacting with backend microservices through REST APIs.\nWe use AWS Cognito for authentication and authorisation, which follows the OAuth 2.0 standard.\nUsers authenticate with AWS Cognito and the web applications ultimately receive an access token in the form of a JWT to authorise the user to access our backend APIs.\nThe `sub` claim contained in the encoded and digitally signed access token identifies the user intending to access the API.\n\nIn this exercise, you will create a Node.js Express middleware package to be consumed by our microservices to validate the access token and read out the user ID.\nThe middleware should meet the following acceptance criteria:\n\n* For a valid token, it should add a `user` field to the request object containing all claims, and then delegate to the next middleware.\n* For an invalid token, it should end the request-response cycle by returning a 401 response.\n* It should confirm the structure of the JWT, validate the JWT signature, and verify the claims, as described in this article: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html.\n\nWe intend to use the `verify` function of the `jsonwebtoken` NPM package to do much of the heavy-lifting (https://www.npmjs.com/package/jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback).\n\nHINT: you might be best using the alternative `decode` function provided by `jsonwebtoken` to get started (https://www.npmjs.com/package/jsonwebtoken#jwtdecodetoken--options).\n\nA failing \"happy path\" test has already been set up for you, including a mock response for the request to retrieve the public key used to verify the token signature.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuffolander%2Fassessment-auth-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuffolander%2Fassessment-auth-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuffolander%2Fassessment-auth-middleware/lists"}