Skip to content

APIGatewayProxyRequestEvent does not have authorizer #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
oharaandrew314 opened this issue Nov 20, 2017 · 8 comments
Closed

APIGatewayProxyRequestEvent does not have authorizer #33

oharaandrew314 opened this issue Nov 20, 2017 · 8 comments

Comments

@oharaandrew314
Copy link

oharaandrew314 commented Nov 20, 2017

The APIGatewayProxyRequestEvent requestContext object does not have the authorizer object. With the new addition of the authorizer context, I am unsure how to structure a new Authorizer object.

It is entirely possible to have an authorizer json blob like:

{
    "principalId": "123", // Required by authorizer
    "roles": "role1,role2",  // Additional arbitrary parameter from authorizer context
    "likes_pie": true // Additional arbitrary parameter from authorizer context
}

The principalId is always part of the authorizer blob, and thus should be a String field on a new Authorizer object. However, the additional arbitrary parameters provided by the authorizer context should be a map. This won't (de)serialize 1:1 between JSON and Java however.

@onema
Copy link

onema commented Jan 15, 2018

I second this, any news on this?

@oharaandrew314
Copy link
Author

Yes, I made a PR in #39

@oharaandrew314
Copy link
Author

@onema, in the meantime, you can do what I do and redefine the file in your project. If you use the exact same package, it should override the version in the library.

@mfulgo
Copy link

mfulgo commented Jun 14, 2018

It would be nice if the authorizer was exposed. Since the values can be anything, perhaps setting them to Objects would be the right thing to do.

It seems the go library uses this approach: https://github.com/aws/aws-lambda-go/blob/v1.2.0/events/apigw.go#L36

@avanathan
Copy link
Contributor

@oharaandrew314 Could you pls. reopen PR #39 ? Everyone making changes in their code repo for a generic change is not a scalable solution. Thanks!

@oharaandrew314
Copy link
Author

oharaandrew314 commented Feb 18, 2019

@avanathan I'm no longer using lambdas with Java, so I believe I'd be a poor champion for the PR. If you wish, feel free to copy my changes and make your own PR.

You may have the modify the map to use Object though. It does seem that you can get non-string values in some cases; though I have never encountered any.

@avanathan
Copy link
Contributor

avanathan commented Feb 18, 2019

@oharaandrew314 Thanks. I did open a PR - #77, but kept it Map<String, String>. Mainly because there are other collections using String key-value. Also, as per my understanding the other non-String objects get converted to Strings before they are added to this map. Hope this rationale makes sense.

@carlzogh
Copy link
Contributor

This was released as part of version 2.2.6 - thanks for your PR @avanathan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants