aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Support for custom authorizer in Swagger definition

Open sapessi opened this issue 7 years ago • 6 comments

Implement support for the execution of custom authorizers when defined in the API swagger template. The implementation should at least run the authorizer function, capture the output template, and verify that the request is allowed. Context variables returned by the authorizer should be injected in the context.

sapessi avatar Dec 06 '17 22:12 sapessi

@sapessi Anyone actively working on that? Any help needed?

ericofusco avatar Jan 25 '19 16:01 ericofusco

@ericofusco I am not aware of anyone working on this currently. Contributions are always welcome. :)

Calling the cloud function could difficult currently. SAM CLI does not yet resolve Fn:Sub intrinsic functions. We may be able to extract the function name and assume we are in the account and region specified but full ARNs won't be possible to support yet. This issue was originally created before SAM supported Custom Authorizers, so it's worth considering starting from local execution first and then expand to the cloud if needed.

The best place to start would be to do a quick write up, full design isn't probably needed. This will help orient/align us before getting deep into code. Happy to talk more on the #samdev channel as well.

jfuss avatar Jan 25 '19 16:01 jfuss

Thanks @jfuss. I'll reach out on #samdev to get this started.

ericofusco avatar Feb 04 '19 12:02 ericofusco

So is it currently impossible to execute an API Gateway locally with authorizer and lambda proxy integration?

retka avatar Oct 02 '19 11:10 retka

So is it currently impossible to execute an API Gateway locally with authorizer and lambda proxy integration?

My testing seems to bear this out. As far as I can tell using the sam local start-api command simply ignores the existence of custom authorizers and passes the request straight to the API backing lambda functions.

NightWatchman avatar Feb 14 '20 18:02 NightWatchman

SAM doesn't support custom authorizers when you run locally now (SAM version 0.48). So you can't test it by using "sam local start-api".

But it supports in SAM YAML template and you can use SAM CLI to build and deploy custom authorizers to you AWS cloud Api Gateway. It can work well if your YAML setup is correct.

LennyDuan avatar May 12 '20 17:05 LennyDuan

This is a duplicate of https://github.com/aws/aws-sam-cli/issues/137.

Closing

jfuss avatar Dec 20 '22 20:12 jfuss

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Dec 20 '22 20:12 github-actions[bot]