壁壘中是否不可能同時具有傳輸級安全性和消息級安全性?為什麼? (Is it impossible to have both transport level security and message level security in rampart? Why?)


問題描述

壁壘中是否不可能同時具有傳輸級安全性和消息級安全性?為什麼? (Is it impossible to have both transport level security and message level security in rampart? Why?)

I'm using rampart to secure communication from a webservice client.

Following the specification i defined an asymmetric binding assertion to provide message level security, but I also want to have the communication with webservice over SSL, thus I also defined an appropriate transport binding assertion.

The effect is that my client is able to connect to the webservice over SSL, but in the message that's being sent, there are no signatures ‑ it seems as if the asymmetric binding assertions were ignored.

Is it actually the case? If so ‑ is this a bug in rampart, or is it somehow forbidden by WS Security Policy spec (I haven't found any such information)?

Looking into rampart's MessageBuilder class source I've found this:

if(rpd.isTransportBinding()) {
   log.debug("Building transport binding");
   TransportBindingBuilder building = new TransportBindingBuilder();
   building.build(rmd);
} else if(rpd.isSymmetricBinding()) {
   log.debug("Building SymmetricBinding");
   SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
   builder.build(rmd);
} else {
   AsymmetricBindingBuilder builder = new AsymmetricBindingBuilder();
   builder.build(rmd);
}

(the whole code: http://grepcode.com/file/repo1.maven.org/maven2/org.apache.rampart/rampart‑core/1.6.2/org/apache/rampart/MessageBuilder.java)

It again makes me think, that one can use only one of security binding and if there are more of them, one is chosen with priority according to above code.


參考解法

方法 1:

I too agree to the point that the specification doesn't say if we can use more than one binding or not (but may be we both have missed it). But you can still use Asymmetric binding for an HTTPS endpoint.  

方法 2:

Finally I think I've solved my problem.

Initially I thought, that the client needs to have the transport binding assertion in it's policy in order to communicate with the webservice over SSL. I also thought, that without such an assertion ramp:sslConfig statements will be ignored.

The truth is, that you don't need transport binding assertion to make it possible to communicate over SSL, you need them to make it required. If there are no such assertions in your client's policy, but the endpoint is requiring SSL connection, the client will still try to establish it and if necessary, look for javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword variables configured in policy's ramp:sslConfig tags, or in other ways (via JVM arguments, or programmatically).

So in my case the solution was to leave the asymmetric binding assertion unchanged and only configure the trustStore, without adding any transport binding assertion.

Still it remains unclear to me why wouldn't rampart let you use the two kinds of assertion in one policy.

(by kemotSureshAttkemot)

參考文件

  1. Is it impossible to have both transport level security and message level security in rampart? Why? (CC BY‑SA 3.0/4.0)

#java #ws-security #web-services #SSL #rampart






相關問題

電子郵件地址中帶有 + 字符的 Java 郵件 (Java mail with + character in email address)

如何快速原型化 Java 代碼? (How to quickly prototype Java code?)

如何使用 Maven 在目標(SVN-)服務器上創建 Javadoc? (How to create Javadoc on the target (SVN-) server using Maven?)

為什麼檢查二叉樹有效性的解決方案不起作用? (Why the solution for checking the validity of binary tree is not working?)

Selenium webdriver通過第一個數字找到texy (Selenium webdriver find texy by first digits)

setOnClickListener 沒有在圖像視圖上被調用 (setOnClickListener is not getting called on image view)

繪製多邊形:找不到錯誤 (Drawing Polygon : unable to find error)

半透明 JButton:對像出現在背景中 (Semi-Transparent JButton: Objects appear in Background)

比較同一數組的元素 (Compare elements of the same array)

Java 屏幕截圖小程序 (Java screen capture applet)

Minecraft 1.8.9 Forge Modding 的Java 開發工具包,需要什麼JDK/JRE,代碼是否正確? (Java Development Kit with Minecraft 1.8.9 Forge Modding, What JDK/JRE Is Needed, Is Code Correct?)

java while (resultset.next()) 不返回同一列中的所有數據 (java while (resultset.next()) does not return all data in the same column)







留言討論