請求策略和回應策略定義與認證提供者執行的請求處理和回應處理相關的認證策略需求。按照訊息寄件者的順序表示這些策略,從而使內容之後出現的加密請求意味著訊息收件者將在驗證簽名之前先要對訊息進行解密。
若要獲得訊息安全性,必須同時在伺服器和用戶端中啟用請求策略和回應策略。在用戶端和伺服器中配置策略時,請確定應用程式層級訊息連結之請求/回應保護的用戶端策略與伺服器策略相匹配。
若要設定應用程式用戶端配置的請求策略,請依循啟用應用程式用戶端的訊息安全性中的說明,修改特定於 Application Server 的應用程式用戶端容器配置。在應用程式用戶端配置檔案中,增加以下所示的 request-policy 和 response-policy 元素,以設定請求策略。
提供的其他代碼可用做參照。其他代碼在安裝中可能略有不同。請勿變更這些代碼。
<client-container> <target-server name="your-host" address="your-host" port="your-port"/> <log-service file="" level="WARNING"/> <message-security-config auth-layer="SOAP" default-client-provider="ClientProvider"> <provider-config class-name="com.sun.enterprise.security.jauth.ClientAuthModule" provider-id="ClientProvider" provider-type="client"> <request-policy auth-source="sender | content" auth-recipient="after-content | before-content"/> <response-policy auth-source="sender | content" auth-recipient="after-content | before-content"/> <property name="security.config" value="as-install/lib/appclient/wss-client-config.xml"/> </provider-config> </message-security-config> </client-container> |
auth-source 的有效值包括 sender 和 content。auth-recipient 的有效值包括 before-content 和 after-content。請求策略配置和回應策略配置的動作中提供了用於說明這些值的各種組合結果的表。
如果不想指定請求策略或回應策略,請將該元素保留為空白,例如:
<response-policy/> |