Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit 36bc3bc

Browse files
authored
Merge pull request #378 from umccr/feature/377-iam-auth-mirror-of-api
Support IAM access to APIs
2 parents 2bbc611 + b7b635d commit 36bc3bc

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

data_portal/urls.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
path('files', views.search_file, name='file-search'),
6262
path('file-signed-url', views.sign_s3_file, name='file-signed-url'),
6363
path('storage-stats', views.storage_stats, name='storage-stats'),
64+
# we mirror the API surface at /iam/ - and set that path up in sls with an IAM authorizer as opposed to a JWT one
65+
path('iam/', include(router.urls)),
66+
# the main API surface authenticated using JWTs
6467
path('', include(router.urls)),
6568
]
6669

serverless.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ provider:
2121
iam:
2222
role: ${ssm:/data_portal/backend/lambda_iam_role_arn}
2323
endpointType: regional
24+
logs:
25+
httpApi: true
2426
httpApi:
2527
disableDefaultEndpoint: true
2628
payload: '2.0'
@@ -89,6 +91,17 @@ functions:
8991
path: /{proxy+}
9092
method: POST
9193
authorizer: cognitoJwtAuthorizer
94+
# we mirror the API onto /iam/* and allow IAM access
95+
- httpApi:
96+
path: /iam/{proxy+}
97+
method: GET
98+
authorizer:
99+
type: aws_iam
100+
- httpApi:
101+
path: /iam/{proxy+}
102+
method: POST
103+
authorizer:
104+
type: aws_iam
92105
timeout: 28
93106

94107
migrate:
@@ -300,6 +313,8 @@ custom:
300313
app: data_portal.wsgi.application
301314
packRequirements: false
302315
pythonRequirements:
316+
# lambci don't seem to be updating their images so there is currently no python 3.9 without using custom
317+
dockerImage: mlupin/docker-lambda:python3.9-build
303318
dockerizePip: non-linux
304319
layer: true
305320
zip: false

0 commit comments

Comments
 (0)