JWT and KONG with custom authrizations

房东的猫 提交于 2019-12-08 06:38:21

问题


I went through this tutorial on KONG https://getkong.org/plugins/jwt/

I have an understanding of JWT and authorization concepts. I have prototyped JWT with Spring Boot where I could put my own key value like this {"authorizations":"role_admin, role_user"}.

It is easy to do that in Spring Boot but I am not able to find information on how to do this with KONG. Anyone has any info about it?


回答1:


Kong community edition can handle only the authentication process, (give or deny access to a customer).

Authorization process (what a given customer can do in your application) is handled by your application or by https://getkong.org/plugins/ee-oauth2-introspection/ oauth2 introspection plugin which is enterprise edition only

you can write your own authorization server based on X-Consumer-Username request header if user passed authentication or original token header proxied by kong

hope helps




回答2:


The kong jwt plugin does not support sending custom payload parameters to the upstream api. It does however seem like you can use this plugin (I have not tested it):

https://github.com/wshirey/kong-plugin-jwt-claims-headers

Update:

If you set Kong to forward all headers you'll get the raw Authorization header with the jwt token. So you could base64 decode the jwt token and pull out the claims/payload parameters you need manually in your service.



来源:https://stackoverflow.com/questions/42741820/jwt-and-kong-with-custom-authrizations

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!