luoluoyuyu commented on issue #10730:
URL: https://github.com/apache/apisix/issues/10730#issuecomment-1871698554
The returned functions are as follows
```
return function()
local core = require("apisix.core")
core.ctx.register_var("sub", function(ctx)
local core = require("apisix.core")
local jwt = require("resty.jwt")
local sub_not_found = "not found"
local access_token = core.request.header(ctx, "Authorization")
local result_value
if not access_token then
result_value = sub_not_found
return result_value
end
local jwt_obj = jwt:load_jwt(access_token)
result_value = tostring(jwt_obj.payload.sub)
return result_value
end)
end
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]