【问题标题】:how to validate "Authorization: Bearer <token>" with Mule 3.8?如何使用 Mule 3.8 验证“授权:承载 <token>”?
【发布时间】:2019-11-14 21:02:09
【问题描述】:

我们需要根据标头“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>

【问题讨论】:

  • #1 你能把日志放在
  • @JRichardsz - 感谢您的评论,我在下面提供了答案,将回答您的查询..

标签: spring spring-security mule mule-esb mulesoft


【解决方案1】:

我与 Mulesoft 支持团队沟通后得出结论,这在 Mule 3.8 中是不可能的。

我想出了以下我们可以用于此问题的选项

我们可以使用以下替代方法 1. 使用 API Manager 应用策略或自定义验证 - 非常推荐,因为验证将在加热到实施之前处理。 2. 使用第一个组件来验证请求、Java、脚本等。 3.使用Mule拦截器

【讨论】:

    猜你喜欢
    • 2015-12-30
    • 2020-12-10
    • 1970-01-01
    • 2019-09-23
    • 2019-07-30
    • 2011-04-17
    • 2019-05-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多