Adding dependencies for lua http filter

I am using envoy filter to write a lua HTTP filter that can extract the user claims from a JWT token. Since the payload in the JWT token is base64 encoded, I am using lua to decode it and parse the claims to extract email id. However, I did not find any preinstalled libraries which can help with extracting payload from a jwt token, decoding base64 or convert the decoded payload from string to a table format.

Am I missing something? or do I need to build these libraries into envoy? If I need to install them, can someone help with the documentation for how to do it?

Related slack thread: Slack

I did it this way

1 Like

@revl-ca Thanks for sharing.

What is the header in which your application receives jwt token? I am seeing the following line in the code linked about but unsure where the header is specified

local meta = request_handle:streamInfo():dynamicMetadata():get("envoy.filters.http.jwt_authn")

In my case, I receive the jwt token is in a custom header x-amzn-oidc-data. Would you know how to handle this?

Yeah, authorization header here.

I don’t know except something like having another filter that change it to authorization header otherwise no, I don’t know.

Let me know if you find something.