claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 274 forks source link

Support authorizationType: 'AWS_IAM' #56

Closed cbumgard closed 8 years ago

cbumgard commented 8 years ago

Please use GitHub issues only to report bugs. To ask a general question or request assistance/support, please use the Claudia.js Gitter Chat instead.

To report a bug or a problem, please fill in the sections below. The more you provide, the better we'll be able to help.


gojko commented 8 years ago

@cbumgard this should not be a difficult change. would you like to implement it and submit a PR? I could guide you through that.

cbumgard commented 8 years ago

Sure, I'd be happy to. How do you see the auth type getting set in the client code? I would assuming in API builder calls that define the methods, as some methods will require auth type none while some will require aws_iam.

On Tue, Jul 19, 2016 at 5:11 PM, Gojko Adzic notifications@github.com wrote:

@cbumgard https://github.com/cbumgard this should not be a difficult change. would you like to implement it and submit a PR? I could guide you through that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/claudiajs/claudia/issues/56#issuecomment-233803641, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFdZ3wU3WI0hpSx88ulGvii-JTeJd9vks5qXWfGgaJpZM4JQNvZ .

gojko commented 8 years ago

@cbumgard I propose adding that as a config for the request handler. This should be quite similar to how ApiKeyRequired is used.

Check out this test: https://github.com/claudiajs/claudia/blob/master/spec/rebuild-web-api-spec.js#L313

The code for apiKeyRequired is in these two lines: https://github.com/claudiajs/claudia/blob/master/src/tasks/rebuild-web-api.js#L227 https://github.com/claudiajs/claudia/blob/master/src/tasks/rebuild-web-api.js#L116

that should be more or less everything you need to set the right flag and test it. I'm not sure if any additional config is then required for the handlers but api builder will pass on the authentication info in the request object automatically. see https://github.com/claudiajs/claudia-api-builder/blob/master/docs/api.md#the-request-object

cdock1029 commented 8 years ago

Can "invoke with caller credentials" be supported here as well?

See https://github.com/awslabs/aws-apigateway-importer/issues/125

gojko commented 8 years ago

@cdock1029 the original change for this issue is now merged. If you want to add additional support for caller credentials, go ahead and submit a new PR

dhackner commented 8 years ago

I'm looking to add User Pool authentication as well here; I've made the necessary change to allow for CUSTOM or COGNITO_USER_POOLS but I'm wondering if the underlying AWS.apiService doesn't yet support it?

gojko commented 8 years ago

@dhakner custom authorizer support is coming in a day or two, I'm cleaning it up now. Regarding cognitive pools, I don't know, never used that. If you made that work, please submit a PR and a test case

dhackner commented 8 years ago

I started support for both and then saw your branch :-). I'll add it based off of your work and then just rebase once you've merged your WIP.

gojko commented 8 years ago

@dhackner it's now merged into master, I plan to add a few more validation tests and then work on the api builder side of things. so you can fork master now and change stuff, it won't change much

dhackner commented 8 years ago

👍

dhackner commented 8 years ago

Mind adding an example invocation to the README or example project?

gojko commented 8 years ago

@dhackner example invocation of what?