Skip to content

Support JWT extraction from cookies in jwt_authn #17424

Closed

Description

@theshubhamp

Title: Support JWT extraction from cookies in jwt_authn

Description:
It's common for JWTs to be sent as HttpOnly cookies from a browser. jwt_authn currently supports extraction from headers and query parameters but lacks the ability to work with cookies.

It can be made to work with cookies by using a combination of these 3 filters as discussed on #7025's comment:
header_to_metatdata -> metadata to header (using Lua ) -> jwt_authn

Adding first party support to extract from cookies will make doing this much easier.

Activity

  1. added
    enhancement
    triage
    on Jul 20, 2021
  2. theshubhamp commented on Jul 20, 2021

    @theshubhamp
    ContributorAuthor

    Looked at the structure of jwt_authn and I believe it can be done this way:

    • Add from_cookies to config schema that accepts cookie names as a list (similar to from_params)
    • Change extractor.cc to extract cookies from requests.

    I can contribute a PR if the community thinks this would be a good addition

  3. htuch commented on Jul 21, 2021

    @htuch
    Member

    Seems a reasonable feature. @qiwzhang WDYT?

  4. added and removed
    triage
    on Jul 21, 2021
  5. tilgovi commented on Aug 6, 2021

    @tilgovi

    Came here from #7025 to say that I would find this useful and am currently using header_to_metadata -> lua -> jwt_authn.

  6. qiwzhang commented on Aug 11, 2021

    @qiwzhang
    Contributor

    Yes, it will be a good feature to have.

  7. theshubhamp commented on Aug 11, 2021

    @theshubhamp
    ContributorAuthor

    Great, I'll try it out and send a PR

  8. added a commit that references this issue on Sep 3, 2021
    143083c
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

    area/jwt_authnenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions