HTTP 基本認証の取得に問題があります。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
認証を使用しない場合、すべて正常に機能します。これを経験して解決策を見つけた人はいますか?たぶん私は非常に単純でばかげた間違いを犯したのかもしれませんが、その場合は本当にそれを見ることができません... 注: Mule はスタンドアロンではなく JBoss 4.2.1 内で実行します。
よろしく
ジョナス・ハイネソン