Skip to content
Open
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
21 changes: 16 additions & 5 deletions samcli/lib/providers/api_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@


class ApiCollector:
# Authorizer types that are valid but not Lambda-based, so cannot be emulated locally
_NON_LAMBDA_AUTHORIZERS = {"AWS_IAM", "NONE"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would Cognito authorization need to be included here? I'm not sure if we accept that or not.


def __init__(self) -> None:
# Route properties stored per resource.
self._route_per_resource: Dict[str, List[Route]] = defaultdict(list)
Expand Down Expand Up @@ -108,11 +111,19 @@ def _link_authorizers(self) -> None:
continue

if not authorizer_object and authorizer_name_lookup:
LOG.info(
"Linking authorizer skipped for route '%s', authorizer '%s' is unsupported or not found",
route.path,
route.authorizer_name,
)
if authorizer_name_lookup in self._NON_LAMBDA_AUTHORIZERS:
LOG.info(
"Authorizer '%s' for route '%s' is not supported for local emulation,"
" requests will not be authorized",
authorizer_name_lookup,
route.path,
)
else:
LOG.warning(
"Authorizer '%s' for route '%s' was not found, skipping",
authorizer_name_lookup,
route.path,
)

route.authorizer_name = None

Expand Down
Loading