无法在Mule 3中获得http基本身份验证

时间:2011-10-06 16:33:34

标签: mule http-basic-authentication

我遇到了获取HTTP Basic身份验证的问题。与Mule 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/时,我只是在骡子日志中遇到异常:

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,而不是独立的。

此致

Jonas Heineson

1 个答案:

答案 0 :(得分:1)

当降级并使用Mule 3.1.2而不是3.2.0时,一切都按预期工作。因此版本3.2中似乎存在错误。