我在獲取HTTP基本身份驗證時遇到問題。與Mule 3.2合作。我們早些時候使用過Mule 2.1.1,沒有問題,但現在我被卡住了。我已創建了這樣一個配置的小測試服務的基礎上,騾子文檔中的例子:無法在Mule 3中獲得http基本身份驗證工作
<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)
我已經檢查了回覆標題,並且所有從騾子回來的都是這個。我會期望也會得到表明需要身份驗證的標頭:
Content-Type: text/plain
Content-Length: 243
Connection: close
401 Unauthorized
所有工作正常時,不使用身份驗證。任何其他經歷過這個並找到解決方案的人?也許我做了一個非常簡單而愚蠢的錯誤,但在那種情況下,我真的看不到它...... 注意:我們在JBoss 4.2.1中運行Mule,而不是單獨運行。
問候
喬納斯Heineson
你能以一種能幫助別人的方式回答你自己的問題嗎?如果你這樣做,你可以選擇你的正確答案。這看起來很奇怪,但它是處理這種情況的首選方式。 – Will