Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class APIGatewayAuthorizerResponse:
- https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html
"""

path_regex = r"^[/.a-zA-Z0-9-_\*]+$"
path_regex = r"^[/.a-zA-Z0-9\-_\*\{\}\+]+$"
"""The regular expression used to validate resource paths for the policy"""

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,40 @@ def test_authorizer_response_allow_route_with_underscore(builder: APIGatewayAuth
}


def test_authorizer_response_allow_route_with_proxy_plus(builder: APIGatewayAuthorizerResponse):
builder.allow_route(http_method="GET", resource="/{proxy+}")
assert builder.asdict() == {
"principalId": "foo",
"policyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "execute-api:Invoke",
"Effect": "Allow",
"Resource": ["arn:aws:execute-api:us-west-1:123456789:fantom/dev/GET/{proxy+}"],
},
],
},
}


def test_authorizer_response_allow_route_with_path_parameter(builder: APIGatewayAuthorizerResponse):
builder.allow_route(http_method="GET", resource="/users/{user_id}")
assert builder.asdict() == {
"principalId": "foo",
"policyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "execute-api:Invoke",
"Effect": "Allow",
"Resource": ["arn:aws:execute-api:us-west-1:123456789:fantom/dev/GET/users/{user_id}"],
},
],
},
}


def test_parse_api_gateway_arn_with_resource():
mock_event = {
"type": "TOKEN",
Expand Down
Loading