2

我在获取 HTTP 基本身份验证时遇到问题。与骡子3.2一起工作。我们之前使用过 Mule 2.1.1 没有问题,但现在我被卡住了。根据 Mule 文档中的示例,我创建了一个具有类似配置的小型测试服务:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:spring="http://www.springframework.org/schema/beans"
  xmlns:http="http://www.mulesoft.org/schema/mule/http"
  xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
  xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
  xmlns:ss="http://www.springframework.org/schema/security"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd
    http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
    http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.2/mule-spring-security.xsd
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
....
<spring:beans>
  <ss:authentication-manager alias="authenticationManager">
    <ss:authentication-provider>
      <ss:user-service id="userService">
        <ss:user name="ross" password="ross" authorities="ROLE_ADMIN"/>
        <ss:user name="anon" password="anon" authorities="ROLE_ANON"/>
      </ss:user-service>
    </ss:authentication-provider>
  </ss:authentication-manager>
</spring:beans>

<mule-ss:security-manager>
  <mule-ss:delegate-security-provider name="memory-provider"
                                      delegate-ref="authenticationManager"/>
</mule-ss:security-manager>

<model name="testModel">
  <service name="testService">
    <inbound>
      <http:inbound-endpoint host="localhost" port="8888" exchange-pattern="request-response">
        <mule-ss:http-security-filter realm="mule-realm"/>
      </http:inbound-endpoint>
    </inbound>
....

但是当将浏览器定向到http://localhost:8888/时,我只是在 mule 日志中得到一个异常:

Root Exception stack trace:
org.mule.api.security.UnauthorisedException: Registered authentication is set to com.computas.mt.mule.security.HttpBasicJBossAuthFilter but there was no security context on the session. Authentication denied on endpoint http://localhost:8888. Message payload is of type: String
    at org.mule.transport.http.filters.HttpBasicAuthenticationFilter.authenticateInbound(HttpBasicAuthenticationFilter.java:160)
    at org.mule.security.AbstractEndpointSecurityFilter.authenticate(AbstractEndpointSecurityFilter.java:58)
    at org.mule.security.AbstractAuthenticationFilter.doFilter(AbstractAuthenticationFilter.java:56)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

我检查了响应头,我从 Mule 得到的只是这个。我还希望获得表明需要身份验证的标头:

Content-Type: text/plain
Content-Length: 243
Connection: close

401 Unauthorized

不使用身份验证时一切正常。还有其他人经历过这种情况并找到了解决方案吗?也许我犯了一个非常简单和愚蠢的错误,但在那种情况下我真的看不到它...... 注意:我们在 JBoss 4.2.1 中运行 Mule,而不是独立运行。

问候

乔纳斯·海涅森

4

1 回答 1

1

当降级和使用 Mule 3.1.2 而不是 3.2.0 时,一切都按预期工作。所以3.2版好像有bug。

于 2011-10-18T08:34:13.487 回答