Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prmdr 161 #57

Merged
merged 22 commits into from
Oct 5, 2023
Merged

Prmdr 161 #57

merged 22 commits into from
Oct 5, 2023

Conversation

joefong-nhs
Copy link
Contributor

Story branch PRMDR-161 ACC1.1 | Migrate CIS2 Lambdas to be merged into main

joefong-nhs and others added 6 commits September 15, 2023 16:47
* [PRMDR-163] Add authoriser lambda from AWS's example, added jwt to decode token
* [PRMDR-163] Add unit test for authoriser lambda
---------
Co-authored-by: NogaNHS <noga.sasson1@nhs.net>
* [PRMDR-163] Add authoriser lambda from AWS's example

Co-authored-by: NogaNHS <noga.sasson1@nhs.net>

* [PRMDR-95] added jwt to decode token

Co-authored-by: Joe Fong <joe.fong1@nhs.net>

* [PRMDR-163] Change makefile to zip lambda with --platform manylinux2014_x86_64

Co-authored-by: NogaNHS <noga.sasson1@nhs.net>

* [PRMDR-95] clean up and editing ssm response

Co-authored-by: Joe Fong <joe.fong1@nhs.net>

* [PRMDR-95] added test cases
Co-authored-by: Joe Fong <joe.fong1@nhs.net>

* [PRMDR-163] Add unit test for authoriser lambda, run formatter, removed unused 'context' and 'principalId'

Co-authored-by: NogaNHS <noga.sasson1@nhs.net>

* [PRMDR-163] Run `make format`, edit the linebreaks in amazon Apache license to satisfy linter

Co-authored-by: NogaNHS <noga.sasson1@nhs.net>

* [PRMDR-163] Add region_name to mock ssm client

Co-authored-by: NogaNHS <noga.sasson1@nhs.net>

* [PRMDR-163] Add region_name to ssm client

* [PRMDR-163] Improve variable names in authoriser handler

* [PRMDR-95] initial token_handler.py encode incoming event body
Co-authored-by: Joe Fong <joe.fong1@nhs.net>

* [PRMDR-95] adding expiry time for token
Co-authored-by: Joe Fong <joe.fong1@nhs.net>

* [PRMDR-95] test cases
Co-authored-by: Joe Fong <joe.fong1@nhs.net>

* [PRMDR-167] Add OIDC Service to interact with CIS2

* [PRMDR-167] Add OIDC service to token handler to fetch user token and org codes

* [PRMDR-167] Correct how token handler get auth code, fix format warnings

* [PRMDR-167] Change to fetch OIDC configs from ssm instead of read from env var

* [PRMDR-167] Add ods api service and unit test

Co-authored-by: Richard Smith <richard.smith33@nhs.net>

* [PRMDR-167] Rename folder pds_data to test_data, add test data for ods api response

* [PRMDR-167] Add ID token verification to OIDC service

* [PRMDR-167] Parse response from ODS Api and extract permitted role

* [PRMDR-167] Mock the id token validation in unit test of fetch_tokens

* [PRMDR-167] Add unit test for OIDC service validate_and_decode_token

* Prmdr 163 migrate authorisation handler (#42)

* [PRMDR-163] Add authoriser lambda from AWS's example, added jwt to decode token
* [PRMDR-163] Add unit test for authoriser lambda
---------
Co-authored-by: NogaNHS <noga.sasson1@nhs.net>

* [PRMDR-167] Add state verification, issuing signed authorisation token, session creation in token lambda

* [PRMDR-167] Amend ods_api_service to return organisation info in dict form, for better readability

* [PRMDR-167] Use a temp dynamo resource instance in token handler. to be switch to DynamoService after merge with other branch

* [PRMDR-167] Add several unit test to lambda

* [PRMDR-167] Add more unit tests to token_handler, improve logging in related code

* [PRMDR-167] Change location of test data file to match other branch, put MockResponse class as a separate helper file

* [PRMDR-167] Amend authoriser handler to check login session and match the new NDR token structure

* [PRMDR-167] Run formatter

* [PRMDR-167] Refactor token handler lambda

* [PRMDR-167] undo unintentional formatter change in .tsx file

* [PRMDR-167] Remove a completed todo comment

* [PRMDR-167] Minor refactor of authoriser_handler lambda

* [PRMDR-167] remove unused comment, undo unintentional formatter change

* [PRMDR-167] Update yml for deploying lambda

* [PRMDR-167] Amend token request lambda to be able to catch the error when both code and state are missing

* [PRMDR-167] Address PR comments

* [PRMDR-167] Add explanatory comments to OIDC IDTokenClaimSet model

* [PRMDR-167] Minor amendment around NDR token expiry time for clarity

---------

Co-authored-by: NogaNHS <noga.sasson1@nhs.net>
Co-authored-by: Richard Smith <richard.smith33@nhs.net>
* [PRMDR-165] added initial redirect lambda

* [PRMDR-165] added state, and format response in redirect lambda
Co-authored-by: Joe Fong <joe.fong1@nhs.net>
Co-authored-by: Richard Smith <richard.smith33@nhs.net>

* cache state in dynamo when a login request is made

* [PRMDR-165] added try-except,
Co-authored-by: Joe Fong <joe.fong1@nhs.net>
Co-authored-by: Richard Smith <richard.smith33@nhs.net>

* [PRMDR-165] refactoring dynamo_query_service.py to dynamo_services.py

* [PRMDR-165] unit test to redirect lambda mock values

* [PRMDR-165] added unit test for redirect,

* [PRMDR-165] WIP - unit test,

* [PRMDR-165] added unit test for lambda

* [PRMDR-165] Fix failed tests

* [PRMDR-165] Rename test file to match the name of lambda, run formatter

* [PRMDR-165] Add deploy step to github action yml

* [PRMDR-165] Add region name to boto3 call

* [PRMDR-165] Correct lambda function name in yml files

* [PRMDR-165] Add util function to get AWS_REGION from env var, change boto3 calls to use region name from env var if provided

* [PRMDR-165] Addressed PR comments

Co-authored-by: Richard Smith <richard.smith33@nhs.net>

* [PRMDR-165] Address ruff linter warnings, replace hardcoded aws region with get_aws_region

* [PRMDR-165] Fix github action yml files for deploying auth-related lambdas

* [PRMDR-165] Fix github action yml files for deploying auth-related lambdas (2nd)

---------

Co-authored-by: NogaNHS <noga.sasson1@nhs.net>
Co-authored-by: Richard Smith <richard.smith33@nhs.net>
* [PRMDR-165] added initial redirect lambda

* [PRMDR-165] added state, and format response in redirect lambda
Co-authored-by: Joe Fong <joe.fong1@nhs.net>
Co-authored-by: Richard Smith <richard.smith33@nhs.net>

* cache state in dynamo when a login request is made

* [PRMDR-165] added try-except,
Co-authored-by: Joe Fong <joe.fong1@nhs.net>
Co-authored-by: Richard Smith <richard.smith33@nhs.net>

* [PRMDR-165] refactoring dynamo_query_service.py to dynamo_services.py

* [PRMDR-165] unit test to redirect lambda mock values

* [PRMDR-165] added unit test for redirect,

* [PRMDR-165] WIP - unit test,

* [PRMDR-165] added unit test for lambda

* [PRMDR-165] refactoring dynamo_query_service.py to dynamo_services.py

* [PRMDR-165] unit test to redirect lambda mock values

* [PRMDR-166] logout_handler.py wip

* [PRMDR-166] added initial lambda

* [PRMDR-166] adding logs to logout lambda

* Logout handler unit test for 200 response

* Unit tests for logout handler error cases

* Improve test names

* Deleted duplicate test file caused by rename

* [PRMDR-166] Amend github action yml to deploy logout handler lambda

* [PRMDR-166] Fix an issue causing 502 error at logout_handler, change response to 400 Bad Request when user logout with an invalid token

* [PRMDR-166] Fix missing method delete_item_service, reunite with dynamodb service from other branch

* [PRMDR-166] Add unit test for dynamo service delete_item method

* [PRMDR-166] Reunite dynamo service usage with other branch

---------

Co-authored-by: NogaNHS <noga.sasson1@nhs.net>
Co-authored-by: Joe Fong <joe.fong1@nhs.net>
@joefong-nhs joefong-nhs temporarily deployed to development September 26, 2023 09:02 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development September 26, 2023 09:02 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development September 26, 2023 14:38 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test September 26, 2023 14:39 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development September 26, 2023 14:39 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development September 26, 2023 14:39 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test September 26, 2023 14:39 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test September 26, 2023 14:39 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test September 26, 2023 14:39 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development September 26, 2023 14:39 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test September 26, 2023 14:39 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to development September 27, 2023 11:00 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to development September 27, 2023 11:01 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to test September 27, 2023 11:01 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to test September 27, 2023 11:01 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to development September 27, 2023 11:01 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to development September 27, 2023 11:01 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to test September 27, 2023 11:01 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to test September 27, 2023 11:01 — with GitHub Actions Inactive
@RioKnightleyNHS RioKnightleyNHS temporarily deployed to test September 27, 2023 11:01 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test October 5, 2023 12:47 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test October 5, 2023 12:47 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 12:47 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test October 5, 2023 12:47 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:28 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:28 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:28 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:42 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:42 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:42 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:43 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:44 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:44 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:58 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:59 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:59 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:59 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test October 5, 2023 13:59 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test October 5, 2023 13:59 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test October 5, 2023 13:59 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to test October 5, 2023 13:59 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs temporarily deployed to development October 5, 2023 13:59 — with GitHub Actions Inactive
@joefong-nhs joefong-nhs merged commit a635db6 into main Oct 5, 2023
@joefong-nhs joefong-nhs deleted the PRMDR-161 branch October 18, 2023 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants