apisix
apisix copied to clipboard
request help: Custom authentication logic and response #4823
Issue description
你好,两个问题,请帮忙解答我应该如何使用。
- 我需要的场景类似key-auth,但是我还需要在插件获取到自定义key时去调用自定的验证服务进行验证。即,key是变化的,而不是不变的。类似nginx的auth.url功能。
- 验证key后,需要根据验证结果返回自定义的响应body,类似下面。而不是apisix自定义的响应消息体。
{
"code": "TokenOutOfDate",
"msg": "token已过期",
"data": null
}
Please use English on public channel.
- 但是我还需要在插件获取到自定义key时去调用自定的验证服务进行验证。
you can use "resty.http" to do this, Reference: https://github.com/apache/apisix/blob/master/apisix/plugins/wolf-rbac.lua
- 需要根据验证结果返回自定义的响应body
use core.response.exit()
ok, thanks. I will try it later
wait, you mean than I need use "resty.http" to custom authentication logic ? Is there any existing plugin that I can use to do it ?
you mean than I need use
"resty.http"to custom authentication logic
yes, you said to verify with a custom verification service.
Is there any existing plugin that I can use to do it
I don't know which plugin is suitable for your scenario, you can look at the documentation and code and pick the right one yourself.
ok, thanks, I will continue exploring.
This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.