简体   繁体   English

在 WSO2 API Manager 4.1.0 - 动态身份验证中使用基本身份验证公开 API

[英]Expose API with Basic Authentication in WSO2 API Manager 4.1.0 - Dynamic Authentication

There is a WSO2 EI backend running with Basic Auth mechanism.有一个运行Basic Auth机制的 WSO2 EI 后端。

Postman - WSO2 EI URL Hit: Postman - WSO2 EI URL 点击:

WSO2 EI 后端

  • Hosted this backend url in WSO2 API Manager 4.1.0 with Basic Auth mechanism rather than OAuth托管此后端 url 在 WSO2 API Manager 4.1.0 与基本身份验证机制而不是OAuth
  • But this dynamic basic auth is not working, getting 401 unauthorized ERROR as per below postman hit.但是这个动态基本身份验证不起作用,根据以下 postman 命中获得401 unauthorized ERROR

Postman - APIM URL Hit: Postman - APIM URL 命中:

wso2 apim命中

WSO2 APIM Publisher: WSO2 APIM 发布者:

出版商

WSO2 APIM Dev Portal: WSO2 APIM 开发门户:

订阅

TryitTool in DEV Portal: DEV 门户中的 TryitTool:

试用工具

Scenario:设想:

真实场景

  • As per above diagram, Client will send Request to WSO2 APIM Url with Basic Auth credentials which needs to be forwarded to backend url instead of setting static value in Endpoint Security Configurations of Publisher portal.根据上图,客户端将使用基本身份验证凭据向 WSO2 APIM Url 发送请求,需要将其转发到后端 url,而不是在发布者门户的Endpoint Security Configurations中设置 static 值。

Note: Basic Auth credentials ( admin:admin ) is passed in each api hit注意:基本身份验证凭据 ( admin:admin ) 在每次 api 命中时传递

Reference link 参考链接

Am I missing anything?我错过了什么吗? How can we achieve this?我们怎样才能做到这一点?

The API Gateway drops the authentication header and that's why you get 401. You can set the EI credentials at the endpoint credentials so that authentication header is passed to the backend. API 网关丢弃身份验证 header,这就是您获得 401 的原因。您可以在端点凭据处设置 EI 凭据,以便将身份验证 header 传递到后端。 Go to the endpoint section at the APIM and provide the same credentials as the endpoint credentials. Go 到 APIM 的端点部分,并提供与端点凭据相同的凭据。

Although your EI endpoint is secured with basic authentication, you don't need to expose the API at the gateway with basic authentication.尽管您的 EI 端点使用基本身份验证进行保护,但您无需使用基本身份验证在网关处公开 API。 You can use OAuth or API keys.您可以使用 OAuth 或 API 密钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 wso2 api manager 4.1.0 发送 POST 请求 - send POST request in wso2 api manager 4.1.0 设计徽标和 Header 在 WSO2 API Manager 4.1.0 中不起作用 - Styling the Logo and Header not working in WSO2 API Manager 4.1.0 WSO2 API 管理器(wso2am-4.1.0) - 如何指向已经存在的 JDBC 用户存储? - WSO2 API Manager(wso2am-4.1.0) - How to Point an Already Existing JDBC Userstore? WSO2 API Manager(wso2am-4.1.0) - 如何让 carbon 控制台显示应用程序名称? - WSO2 API Manager(wso2am-4.1.0) - How to make the carbon console show application names? WSO2 API Manager(wso2am-4.1.0) - 为开发者门户和发布者定制登录页面 - WSO2 API Manager(wso2am-4.1.0) - Customize Login Pages for Developer Portal and Publisher WSO2 API 管理器 4.1.0 集群双活节点似乎运行不正常 - WSO2 API manager 4.1.0 clustering active-active nodes seems not working well API Manager 4.1.0 accessControlAllowOrigins 的动态值 - API Manager 4.1.0 Dynamic value for accessControlAllowOrigins 使用 WSO2 Identity Server 和 WSO2 API Manager 保护后端 - Securing backend with WSO2 Identity Server and WSO2 API Manager WSO2 API 管理器中的有效负载字段验证 - Payload field validation in WSO2 API Manager WSO2 API 管理器“过滤器”无法正常工作 - WSO2 API Manager `filter` not working as it should
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM