Apply 操作の例

apply​ 操作は、​WssOutboundConfig​ で指定されている設定に従って WSS 情報を SOAP 応答に適用します。

Table 1. パラメーター
名前 M ES デフォルト値 説明

response

はい

いいえ

-

TypedValue <InputStream>

SOAP response (SOAP 応答)

version

いいえ

はい

SOAP_12

SoapVersion

SOAP バージョン: SOAP_11​ または ​SOAP_12

出力は、アウトバウンド設定を適用した結果のヘッダー要素 ​<wsse:Security></wsse:Security>​ を含む SOAP 応答です。この操作は何も属性を返しません。

Table 2. Errors (エラー)
Namespace (名前空間) 説明

WSS

SECURITY_APPLYING

適用なし

応答で WSS の適用に失敗した場合にスローされます。

WSS

MISSING_CERTIFICATE

適用なし

トラストストアまたはキーストアのどちらからも証明書を取得できない場合にスローされます。

暗号化

暗号化操作を実行する場合には、メッセージのペイロードに変換を適用しないでください。変換操作では、暗号化署名が除外されません。

次の例は、キーストアを使用して暗号化を適用する方法を示しています。

暗号化の例
<wss:outbound-config name="encryption-config">
	<wss:encryption-config>
		<wss:keystore-config path="certificates/sign-keystore.jks"
password="mulepassword"
alias="muleclient"
keyPassword="mulepassword" />
	</wss:encryption-config>
</wss:outbound-config>

<flow name="OrderTshirtServiceFlow">
	<http:listener config-ref="HTTP-listener-config" path="/order" />
	<flow-ref name="OrderTshirtFlowImpl" />
	<wss:apply-wss config-ref="encryption-config" version="SOAP_12"/>
</flow>
XML

署名

暗号化操作を実行する場合には、メッセージのペイロードに変換を適用しないでください。変換操作では、暗号化署名が除外されません。

次の例は、キーストアと ​RSAwithSHA1​ アルゴリズムを使用して SOAP メッセージに署名する方法を示しています。

署名の例
<wss:outbound-config name="sign-config">
	<wss:signature-config algorithm="RSAwithSHA1" >
		<wss:keystore-config path="certificates/sign-keystore.jks"
                            	password="mulepassword"
					alias="muleclient"
       	                    keyPassword="mulepassword" />
	</wss:signature-config>
</wss:outbound-config>

<flow name="OrderTshirtServiceFlow">
	<http:listener config-ref="HTTP-listener-config" path="/order" />
	<flow-ref name="OrderTshirtFlowImpl" />
	<wss:apply-wss config-ref="sign-config" version="SOAP_12"/>
</flow>
XML

証明書の暗号化と署名

暗号化操作を実行する場合には、メッセージのペイロードに変換を適用しないでください。変換操作では、暗号化署名が除外されません。

次の例では、署名された要求を検証し、署名証明書を保存して、後でその証明書を ​apply-wss​ 操作で使用して応答に署名しています。

要求の例
<soapenv:Envelope xmlns:ser="http://service.soap.service.mule.org/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.1.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.1.xsd"><ds:Signature Id="SIG-F8FAC4A91BEF76355615530303348205" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="ser soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><ds:Reference URI="#id-F8FAC4A91BEF76355615530303348174"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="ser" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>yLFLEkH4/MjYbZ4viZxjou9/4os=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>xxxxx+xxxxxxxxx==</ds:SignatureValue><ds:KeyInfo Id="KI-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"><wsse:SecurityTokenReference wsu:Id="STR-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"><ds:X509Data><ds:X509IssuerSerial><ds:X509IssuerName>CN=Unknown,OU=Unknown,O=Unknown,L=Unknown,ST=Unknown,C=US</ds:X509IssuerName><ds:X509SerialNumber>1545521240</ds:X509SerialNumber></ds:X509IssuerSerial></ds:X509Data></wsse:SecurityTokenReference></ds:KeyInfo></ds:Signature></wsse:Security></soapenv:Header>
   <soapenv:Body wsu:Id="id-F8FAC4A91BEF76355615530303348174" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.1.xsd">
      <ser:echo>
         <text>test</text>
      </ser:echo>
   </soapenv:Body>
</soapenv:Envelope>
XML
暗号化の例
<wss:inbound-config name="validate-signature-config">
   <wss:verify-signature-config>
       <wss:truststore-config path="certificates/verify-signature-truststore.jks"
					password="mulepassword" />
   </wss:verify-signature-config>
</wss:inbound-config>

<wss:outbound-config name="encryption-without-keystore-config">
   <wss:encryption-config />
</wss:outbound-config>

<flow name="OrderTshirtServiceFlow">
	<http:listener config-ref="HTTP-listener-config" path="/order" />
	<wss:validate-wss config-ref="validate-signature-config" version="SOAP_12" />
	<flow-ref name="OrderTshirtFlowImpl" />
	<wss:apply-wss config-ref="encryption-without-keystore-config"
					version="SOAP_12" />
</flow>
XML