[英]How to Configure HTTP Basic Auth for WSO2 EI proxy service
我正在使用WSO2 Enterprise Integrator 6.5.0(最新)
我需要通過代理服務(SOAP,REST)啟用HTTP基本身份驗證
我在下面的資源中嘗試過-WSO2 EI和WSO2 Developer-使用HTTP基本身份驗證設置ESB代理
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="ProxyWithBasicAuth" startOnLoad="true" trace="disable" transports="https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<endpoint name="endpoint_urn_uuid_xxxxxxxx-yyyy-zzzz-1111-234567892345">
<address trace="disable" uri="https://here.goes.the.uri.of.the.ws.endpoint"/>
</endpoint>
<inSequence>
<property value="this_is_the_username" name="username" scope="default" type="STRING"/>
<property value="this_is_the_password" name="password" scope="default" type="STRING"/>
<property expression="fn:concat($ctx:username,':',$ctx:password)" name="credentials" scope="default" type="STRING"/>
<property expression="fn:concat('Basic ', base64Encode($ctx:credentials))" name="Authorization" scope="transport" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
但這行不通嗎? 我以為我寄錯憑證時,
代理服務會給我錯誤?
請參考這個 。 我認為密鑰應更正為授權而不是代理授權。
看來,您的要求是保護代理服務,該服務將使用基本身份驗證作為REST進行調用。 當代理服務用作SOAP [1]時,建議使用安全策略來保護它。 但是,如果您需要通過代理服務啟用HTTP Basic Auth,則將需要編寫自定義實現以對用戶進行身份驗證,因為ESB默認不支持該實現。 可以使用以下方法之一來滿足您的要求。
實施受基本身份驗證保護 的API ,然后從該API調用代理服務。 API處理程序實現可用於實現身份驗證。 有關API處理程序的實現,請參閱[2] 。
在代理服務調用之前,請使用突觸處理程序來處理身份驗證。 有關突觸處理程序的實現,請參見[3] 。 在ESB代理服務之前,將調用突觸處理程序的handleRequestInFlow()方法。 因此,我們可以在處理程序的handleRequestInFlow()中使用自定義身份驗證實現,並允許/限制代理調用。
1 - https://docs.wso2.com/display/EI650/Applying+Security+to+a+Proxy+Service
2 - https://docs.wso2.com/display/ESB481/Securing+APIs#SecuringAPIs-BasicAuthUsingaBasicAuthhandler
3 - https://docs.wso2.com/display/EI6xx/Working+with+Synapse+Handlers
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.