-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Labels
Description
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:
location /endpoint {
proxy_set_header Host $http_host;
auth_jwt_enabled on;
auth_jwt_algorithm RS384;
auth_jwt_validate_sub on;
auth_jwt_extract_request_claims sub;
if ($http_jwt_sub != "super-user") {
return 401 [$http_jwt_sub];
}
auth_jwt_use_keyfile on;
auth_jwt_keyfile_path "<mysecretlocation>";
auth_jwt_location COOKIE=token;
proxy_pass http://localhost:3000;
}
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 the sub
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?