【问题标题】:WSO2 APIM AuthenticationWSO2 APIM 身份验证
【发布时间】:2016-06-21 14:40:25
【问题描述】:
  1. 我需要通过基本身份验证或摘要式身份验证对想要使用其凭据 (un/pwd) 访问 API 的用户进行身份验证
  2. 还在请求中传递所需的凭据(un/pwd)以验证对后端服务的访问权限

我的突触提取配置如下所示:

<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
<then>
<property name="api.ut.backendRequestTime"
expression="get-property('SYSTEM_TIME')"/>
<property name="password" 
expression="wso2:vault-lookup('PayAdmin--    ZenoAPI51.0')"/>
<property name="unpw" 
expression="fn:concat('user',':',get-property('password'))"/>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode(get-property('unpw')))"
scope="transport"/>
<send>
<endpoint name="PayAdmin--ZenoAPI5_APIproductionEndpoint_0">
<http uri-template="http://localhost:8080/payment/{uri.var.name}"/>
</endpoint>
</send>
</then>

我想知道的是:

curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: Bearer 2e13c9b3c8717f43d093cfc7c63994bb" -d "{}" http://<IP address of APIM Server>:8280/Zeno1/1.0.0/payment/name

此 curl 只能获取不记名令牌,但如何在 curl 中为 API 传递用户/密码和为后端传递用户/密码

【问题讨论】:

  • 您的要求是使用 CURL 将用户名和密码发送到后端,对吗?

标签: wso2 wso2-am


【解决方案1】:

关于你的第二个问题: 对于后端的基本身份验证,您可以在步骤实施 -> 显示更多选项 -> 端点安全方案:设置为安全并提供凭据中的发布者中配置 通用密码 (见:https://docs.wso2.com/display/AM1100/Basic+Auth

如果必须提供用户特定凭据,用户应在 HTTP 标头中设置“Authentication: Basic base64(username:password)”,标头将被传递到后端。

【讨论】:

  • 您好上面提到的基本身份验证。您能否解释一下如何为 Digest auth 传递凭据以及如何配置它?
【解决方案2】:
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: **Basic** **[base64encode(username:password)]**" -d "{}" http://<IP address of APIM Server>:8280/Zeno1/1.0.0/payment/name

[base64encode(username:password)] 将其替换为 base64 编码字符串 “用户名:密码”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-08
    • 2022-06-18
    • 1970-01-01
    • 2019-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-18
    相关资源
    最近更新 更多