Skip to content

APIGatewayProxyRequestEvent does not have authorizer #33

Closed

Description

@oharaandrew314

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.

Activity

  1. onema commented on Jan 15, 2018

    @onema

    I second this, any news on this?

  2. oharaandrew314 commented on Jan 16, 2018

    @oharaandrew314
    Author

    Yes, I made a PR in #39

  3. oharaandrew314 commented on Jan 17, 2018

    @oharaandrew314
    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.

  4. mfulgo commented on Jun 14, 2018

    @mfulgo

    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

  5. avanathan commented on Feb 18, 2019

    @avanathan
    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!

  6. oharaandrew314 commented on Feb 18, 2019

    @oharaandrew314
    Author

    @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.

  7. avanathan commented on Feb 18, 2019

    @avanathan
    Contributor

    @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.

  8. carlzogh commented on Apr 28, 2020

    @carlzogh
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions