Commit a230555 1 parent 5f089f5 commit a230555 Copy full SHA for a230555
File tree 7 files changed +50
-43
lines changed
lambdas/lambda_authorizer
7 files changed +50
-43
lines changed Original file line number Diff line number Diff line change 43
43
run : |
44
44
cd bmh_admin_portal_backend
45
45
poetry run pytest -vv --cov-report xml tests
46
+
47
+ lambda_auth_unit_test :
48
+ runs-on : ubuntu-latest
49
+
50
+ steps :
51
+ - name : Check out code
52
+ uses : actions/checkout@v3
53
+ - name : Set up python
54
+ uses : actions/setup-python@v4
55
+ with :
56
+ python-version : " 3.9"
57
+ - name : Install pip requirements
58
+ run : |
59
+ cd bmh_admin_portal_backend/lambdas/lambda_authorizer
60
+ pip --version
61
+ pip install -r requirements.txt
62
+ - name : Run test
63
+ run : |
64
+ cd bmh_admin_portal_backend/lambdas/lambda_authorizer
65
+ pytest -vv --cov-report xml tests
Original file line number Diff line number Diff line change 3
3
"files": "bmh_admin_portal_ui/package-lock.json|^.secrets.baseline$|^../.secrets.baseline$",
4
4
"lines": null
5
5
},
6
- "generated_at": "2024-06-11T18:37:34Z ",
6
+ "generated_at": "2024-06-13T15:50:28Z ",
7
7
"plugins_used": [
8
8
{
9
9
"name": "AWSKeyDetector"
58
58
}
59
59
],
60
60
"results": {
61
- "lambdas/workspaces_api_resource/workspaces_api_resource_handler.py": [
61
+ "bmh_admin_portal_backend/ lambdas/workspaces_api_resource/workspaces_api_resource_handler.py": [
62
62
{
63
63
"hashed_secret": "505032eaf8a3acf9b094a326dfb1cd0537c75a0d",
64
64
"is_verified": false,
65
65
"line_number": 439,
66
66
"type": "Secret Keyword"
67
67
}
68
68
],
69
- "poetry.lock": [
69
+ "bmh_admin_portal_backend/ poetry.lock": [
70
70
{
71
- "hashed_secret": "7ea91fd4bc39f6ced54285ea67cfa7b247b33376 ",
71
+ "hashed_secret": "c1dd1514fc9014ac7cb6fe5f5c71e5a6f71a01ce ",
72
72
"is_verified": false,
73
- "line_number": 2772 ,
73
+ "line_number": 2740 ,
74
74
"type": "Hex High Entropy String"
75
75
}
76
+ ],
77
+ "bmh_admin_portal_ui/README_DEPLOYMENT.md": [
78
+ {
79
+ "hashed_secret": "a033a528b603fed46f861d4b3542c417b99d41c8",
80
+ "is_verified": false,
81
+ "line_number": 74,
82
+ "type": "Secret Keyword"
83
+ }
84
+ ],
85
+ "bmh_workspace/templates/BMHAccountBaseline.yml": [
86
+ {
87
+ "hashed_secret": "5ef4751aeb252031285d28e935b86bbbe959d6f5",
88
+ "is_verified": false,
89
+ "line_number": 290,
90
+ "type": "Secret Keyword"
91
+ }
76
92
]
77
93
},
78
94
"version": "0.13.1",
Original file line number Diff line number Diff line change 1
1
PyJWT == 2.4.0
2
2
cryptography == 42.0.6
3
+ jwcrypto == 1.5.6
Original file line number Diff line number Diff line change 1
1
import pytest
2
2
import io
3
+ import os
3
4
import json
4
5
import jwt
5
6
import time
@@ -16,6 +17,8 @@ def test_validate_token():
16
17
Tests the functionality of validate token by creating a dummy JWT token using RS256 algorithm.
17
18
Note: We also create an RSA key pair and a JWK for the public key for the test.
18
19
"""
20
+ os .environ ["allowed_client_id_audience" ] = "Valid test audience"
21
+ os .environ ["auth_base_url" ] = "https://mock.data-commons.org/user"
19
22
20
23
# Generate RSA private key
21
24
private_key = rsa .generate_private_key (public_exponent = 65537 , key_size = 2048 )
@@ -94,3 +97,7 @@ def test_validate_token():
94
97
):
95
98
with pytest .raises (ExpiredSignatureError ):
96
99
payload = lambda_authorizer .validate_token (mock_jwt_token )
100
+
101
+ # teardown env vars
102
+ del os .environ ["allowed_client_id_audience" ]
103
+ del os .environ ["auth_base_url" ]
Original file line number Diff line number Diff line change @@ -46,9 +46,6 @@ openapi-core = "^0.17.0"
46
46
pytest = " ^6.0.0"
47
47
pytest-cov = " *"
48
48
pyyaml = " ^6.0.0"
49
- PyJWT = " ^2.4.0"
50
- cryptography = " ^42.0.6"
51
- jwcrypto = " ^1.5.6"
52
49
53
50
[build-system ]
54
51
requires = [" poetry-core>=1.0.0" ]
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ def setup_env_vars():
30
30
"api_usage_id_param_name" : "testUsageId" ,
31
31
"total_usage_trigger_lambda_arn" : "testTotalUsageArn" ,
32
32
"user_services_email" : "DummyUserServices@email.com" ,
33
- "allowed_client_id_audience" : "Valid test audience" ,
34
- "auth_base_url" : "https://mock.data-commons.org/user" ,
35
33
},
36
34
):
37
35
yield
You can’t perform that action at this time.
0 commit comments