如何在 WSO2 OAuth2 及其后端 API 服务器 Oauth2 中传递授权标头? [英] How to pass authorization header in WSO2 OAuth2 and its backend API server Oauth2?

查看:36
本文介绍了如何在 WSO2 OAuth2 及其后端 API 服务器 Oauth2 中传递授权标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WSO2 API 管理器及其后端 API 服务器(在 Azure 上)都使用 OAuth2.

Both of the WSO2 API manager and its backend API server(on Azure) are using OAuth2.

它们都使用相同的标题,如下所示:

They all use the same header as follow:

WSO2 API 管理器

授权:承载 72135e9f1dc96201949351261284dc7

Authorization: Bearer 72135e9f1dc96201949351261284dc7

API 服务器

授权:承载 MfGb9pnTEGVWmDyjlfSZjlxhc8pFtef

Authorization: Bearer MfGb9pnTEGVWmDyjlfSZjlxhc8pFtef

我使用 Rest 客户端进行测试.我发现我可以通过WSO2 API Manager OAuth2,但无法通过API Server OAuth2.

I use Rest client to do the test. I find that I can pass the WSO2 API Manager OAuth2, but can not pass the API Server OAuth2.

消息是:此请求的授权已被拒绝."由 API Server 返回.

the message is: "Authorization has been denied for this request." return by the API Server.

如何通过重新配置 WSO2 API Manager 来解决此问题?

How can I solve this issue by reconfigure WSO2 API Manager ?

非常感谢.

推荐答案

当带有授权标头的请求到达 WSO2 API 管理器时会发生什么,它会读取令牌,针对密钥管理器进行验证并删除该令牌调用后端 API 服务器之前的令牌.如果您想在后端API服务器中添加另一个授权头,您可以在API中依次定义一个中介扩展[1],并通过头中介添加授权令牌.

What happens when a request comes to the WSO2 API Manager with an authorization header is that, it will read the token, validate that against the key manager and drop that token before calling the back end API server. If you want add another authorization header to the back end API server, you can define a mediation extension[1] in sequence in the API and add the authorization token through a header mediator.

<header name="Authorization" value="Bearer MfGb9pnTEGVWmDyjlfSZjlxhc8pFtef"/>

[1] https://docs.wso2.com/display/AM190/添加+中介+扩展

这篇关于如何在 WSO2 OAuth2 及其后端 API 服务器 Oauth2 中传递授权标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆