簡體   English   中英

如何驗證“授權:承載<token> ”與騾子3.8?</token>

[英]how to validate “Authorization: Bearer <token>” with Mule 3.8?

我們需要根據 header "Authorization: Bearer" 對 REST 請求進行身份驗證。 我使用以下配置來啟用 Mule HTTP 安全性。 默認情況下,騾子注冊“org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter”,所以我必須通過基本授權只用用戶名和密碼。 我試圖覆蓋 HttpBasicAuthenticationFilter 但我無法覆蓋它。 根據我們的要求,我們需要驗證 Bearer 令牌。

您能否提供任何指向使用 Mule 3.8 驗證“授權:承載”的指針。

  <spring:beans>
    <spring:bean id="apiAuthenticationProvider" name="apiAuthenticationProvider" class="com.poc.ApiAuthenticationProvider" />
    <ss:authentication-manager id="authenticationManager">
            <ss:authentication-provider ref="apiAuthenticationProvider" />
        </ss:authentication-manager>
  </spring:beans>

  <mule-ss:security-manager  name="muleSecurityManager" doc:name="Spring Security Provider">
      <mule-ss:delegate-security-provider name="memory-provider" delegate-ref="authenticationManager" />
  </mule-ss:security-manager>

  <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration" />

  <flow name="SpringExample">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <mule-ss:http-security-filter realm="mule-realm" securityManager-ref="muleSecurityManager" />
  </flow>

我與 Mulesoft 支持團隊溝通后得出結論,這在 Mule 3.8 中是不可能的。

我想出了以下選項,我們可以使用這些選項來解決這個問題

我們可以使用以下替代方法 1. 使用 API 管理器應用策略或自定義驗證 - 非常推薦,因為驗證將在加熱實施之前處理。 2. 使用第一個組件來驗證請求,Java,腳本等 3. 使用 Mule 攔截器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM