-
Notifications
You must be signed in to change notification settings - Fork 124
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
Document issues using if
and return
with headers
#100
Comments
Can you confirm which version of NGINX you're using, please? |
@JoshMcCullough The system is using NGINX version 1.21.1. |
In our tests, we ended up using a header to store the value of the extracted claim(s) because we, too, noticed that All we are doing in the module is pulling the claim out of the JWT and storing it in the reqeuest and/or response headers. We format the name of the header as This works when writing the claim value to response header: add_header "Test" "sub=$http_jwt_sub"; But not when using return 200 "test ... $http_jwt_sub ... "; Nor when using set $sub $http_jwt_sub;
return 200 "test ... $sub ... "; In fact, when using add_header "Test" "sub=$http_jwt_sub";
return 200 "test ... $http_jwt_sub ..."; Outputs:
This may be a case of the rewrite module overwriting the headers, as is seen when you use Also, it is not generally recommended to use |
Thanks for the response. In my case, I don't actually need to return the value of
But, perhaps unsurprisingly, the |
Yeah, there's no need to use |
In my original code, the |
Ah, sorry I misunderstood that. I've been messing around with this and I don't know if it's a bug or not, but it seems like as soon as you use I don't have an answer for you currently. But I will backtrack again on my I'll continue looking for a solution and will report back if I can find something... |
FWIW I did find a workaround for my issue. The service at my target endpoint supports role based access so I used a map on the
And the |
Excellent! I'll close this issue as there's nothing for us to do. |
Actually, we can use this ticket to add some docs regarding this. |
auth_jwt_extract_request_claims
if
and return
with headers
Hello, I am currently looking to only allow a particular user (JWT subject) to access a specific endpoint on my web server. So I am using the following configuration to do so:
This configuration works without the bit where I try to validate the claims. It even allows access with the
auth_jwt_validate_sub on;
config. It validates thesub
exists but my page yields empty brackets[]
on return (i.e. the $http_jwt_sub variable is empty). I have tested and found that it fails to extract any values for other parameters of my JWT payload as well. And I can confirm that my JWT does in fact contain these fields:Has anyone else experienced this or is there some syntax I am not following properly?
The text was updated successfully, but these errors were encountered: