バージョン 5.x アプリケーションを Web サービス・セキュリティーでセキュアするには、 IBM 拡張デプロイメント記述子および IBM 拡張バインディングに、セキュリティー制約を定義する必要があります。 サンプル構成では、サンプルの鍵ストア・ファイル、およびデフォルトのバインディング情報が提供されています。 これによって、IBM デプロイメント記述子拡張およびバインディングの機能が示されています。
以下の例では、IBM デプロイメント記述子の拡張およびバインディングの機能を示します。 分かりやすくするために、必要のない情報は例から除去されています。 この例をご使用のアプリケーション・デプロイメント記述子やバインディングにコピーして貼り付けないでください。 この例は参照用であり、推奨される構成ではありません。
応答の場合、SOAP 本体とタイム・スタンプは署名され、本体の内容は暗号化されて、タイム・スタンプを使用して SOAP メッセージの最新度がチェックされます。 メッセージの最新度によって、そのメッセージが事前定義された時間の制約に準拠しているかどうかが示されます。
要求送信側と要求受信側はペアになっています。 同様に、応答送信側と応答受信側もペアになっています。クライアント・サイドの IBM デプロイメント記述子の拡張
クライアント・サイドの IBM デプロイメント記述子の拡張には、以下の制約が記述されています。
例 1: クライアントの IBM デプロイメント記述子拡張のサンプル
<?xml version="1.0" encoding="UTF-8"?> <com.ibm.etools.webservice.wscext:WsClientExtension xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.etools.webservice.wscext= http://www.ibm.com/websphere/appserver/schemas/5.0.2/wscext.xmi"> <serviceRefs serviceRefLink="service/myServ"> <portQnameBindings portQnameLocalNameLink="Port1"> <clientServiceConfig actorURI="myActorURI"> <securityRequestSenderServiceConfig actor="myActorURI"> <integrity> <references part="body"/> <references part="timestamp"/> <references part="securitytoken"/> </integrity> <confidentiality> <confidentialParts part="bodycontent"/> <confidentialParts part="usernametoken"/> </confidentiality> <loginConfig authMethod="BasicAuth"/> <addCreatedTimeStamp flag="true" expires="PT3M"/> </securityRequestSenderServiceConfig> <securityResponseReceiverServiceConfig> <requiredIntegrity> <references part="body"/> <references part="timestamp"/> </requiredIntegrity> <requiredConfidentiality> <confidentialParts part="bodycontent"/> </requiredConfidentiality> <addReceivedTimeStamp flag="true"/> </securityResponseReceiverServiceConfig> </clientServiceConfig> </portQnameBindings> </serviceRefs> </com.ibm.etools.webservice.wscext:WsClientExtension>
クライアント・サイドの IBM 拡張のバインディング
例 2 では、クライアント・サイドの IBM デプロイメント記述子の拡張に関するセクションで説明したセキュリティー制約のクライアント・サイドの IBM 拡張のバインディングが示されます。
メッセージの署名者鍵および暗号 (暗号化解除) 鍵は、鍵ストア鍵ロケーターのインプリメンテーションから取得できます (com.ibm.wsspi.wssecurity.config.KeyStoreKeyLocator)。 署名者鍵は、応答を暗号化する場合に使用します。 このサンプルは、Java Certification Path API を使用して、 デジタル・シグニチャーの署名者の認証パスを検証するよう構成されています。 ユーザー名トークン (基本認証) データは、 デフォルトの JAAS インプリメンテーションの 1 つである :javax.security.auth.callback.CallbackHandler インプリメンテーションを使用して、 標準入力 (STDIN) プロンプトから収集されます (com.ibm.wsspi.wssecurity.auth.callback.StdinPromptCallbackHandler)。
例 2: クライアントの IBM 拡張バインディングのサンプル
<?xml version="1.0" encoding="UTF-8"?> <com.ibm.etools.webservice.wscbnd:ClientBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.etools.webservice.wscbnd= "http://www.ibm.com/websphere/appserver/schemas/5.0.2/wscbnd.xmi"> <serviceRefs serviceRefLink="service/MyServ"> <portQnameBindings portQnameLocalNameLink="Port1"> <securityRequestSenderBindingConfig> <signingInfo> <signatureMethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <signingKey name="clientsignerkey" locatorRef="SampleClientSignerKey"/> <canonicalizationMethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <digestMethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> </signingInfo> <keyLocators name="SampleClientSignerKey" classname= "com.ibm.wsspi.wssecurity.config.KeyStoreKeyLocator"> <keyStore storepass="{xor}PDM2OjEr" path= "$${USER_INSTALL_ROOT}/etc/ws-security/samples/dsig-sender.ks" type="JKS"/> <keys alias="soaprequester" keypass="{xor}PDM2OjEr" name="clientsignerkey"/> </keyLocators> <encryptionInfo name="EncInfo1"> <encryptionKey name="CN=Bob, O=IBM, C=US" locatorRef= "SampleSenderEncryptionKeyLocator"/> <encryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <keyEncryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/> </encryptionInfo> <keyLocators name="SampleSenderEncryptionKeyLocator" classname= "com.ibm.wsspi.wssecurity.config.KeyStoreKeyLocator"> <keyStore storepass="{xor}LCswLTovPiws" path= "$${USER_INSTALL_ROOT}/etc/ws-security/samples/enc-sender.jceks" type="JCEKS"/> <keys alias="Group1" keypass="{xor}NDomLz4sLA==" name="CN=Group1"/> </keyLocators> <loginBinding authMethod="BasicAuth" callbackHandler= "com.ibm.wsspi.wssecurity.auth.callback.StdinPromptCallbackHandler"/> </securityRequestSenderBindingConfig> <securityResponseReceiverBindingConfig> <signingInfos> <signatureMethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <certPathSettings> <trustAnchorRef ref="SampleClientTrustAnchor"/> <certStoreRef ref="SampleCollectionCertStore"/> </certPathSettings> <canonicalizationMethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <digestMethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> </signingInfos> <trustAnchors name="SampleClientTrustAnchor"> <keyStore storepass="{xor}PDM2OjEr" path= "$${USER_INSTALL_ROOT}/etc/ws-security/samples/dsig-sender.ks" type="JKS"/> </trustAnchors> <certStoreList> <collectionCertStores provider="IBMCertPath" name="SampleCollectionCertStore"> <x509Certificates path="$${USER_INSTALL_ROOT}/etc/ws-security/samples/intca2.cer"/> </collectionCertStores> </certStoreList> <encryptionInfos name="EncInfo2"> <encryptionKey locatorRef="SampleReceiverEncryptionKeyLocator"/> <encryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <keyEncryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/> </encryptionInfos> <keyLocators name="SampleReceiverEncryptionKeyLocator" classname= "com.ibm.wsspi.wssecurity.config.KeyStoreKeyLocator"> <keyStore storepass="{xor}PDM2OjEr" path= "$${USER_INSTALL_ROOT}/etc/ws-security/samples/dsig-sender.ks" type="JKS"/> <keys alias="soaprequester" keypass="{xor}PDM2OjEr" name="clientsignerkey"/> </keyLocators> </securityResponseReceiverBindingConfig> </portQnameBindings> </serviceRefs> </com.ibm.etools.webservice.wscbnd:ClientBinding>
サーバー・サイドの IBM デプロイメント記述子の拡張
クライアント・サイドの IBM デプロイメント記述子の拡張には、以下の制約が記述されています。
例 3: サーバーの IBM デプロイメント記述子拡張のサンプル
<?xml version="1.0" encoding="UTF-8"?> <com.ibm.etools.webservice.wsext:WsExtension xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.etools.webservice.wsext= http://www.ibm.com/websphere/appserver/schemas/5.0.2/wsext.xmi"> <wsDescExt wsDescNameLink="MyServ"> <pcBinding pcNameLink="Port1"> <serverServiceConfig actorURI="myActorURI"> <securityRequestReceiverServiceConfig> <requiredIntegrity> <references part="body"/> <references part="timestamp"/> <references part="securitytoken"/> </requiredIntegrity> <requiredConfidentiality"> <confidentialParts part="bodycontent"/> <confidentialParts part="usernametoken"/> </requiredConfidentiality> <loginConfig> <authMethods text="BasicAuth"/> </loginConfig> <addReceivedTimestamp flag="true"/> </securityRequestReceiverServiceConfig> <securityResponseSenderServiceConfig actor="myActorURI"> <integrity> <references part="body"/> <references part="timestamp"/> </integrity> <confidentiality> <confidentialParts part="bodycontent"/> </confidentiality> <addCreatedTimestamp flag="true" expires="PT3M"/> </securityResponseSenderServiceConfig> </serverServiceConfig> </pcBinding> </wsDescExt> </com.ibm.etools.webservice.wsext:WsExtension>
サーバー・サイドの IBM 拡張のバインディング
以下のバインディング情報では、システムに応じてサーバー・レベルまたはセル・レベルで定義されたデフォルトのバインディング情報の一部が再利用されます。 例えば、要求受信側は SampleCollectionCertStore 認証ストアを参照し、SampleServerTrustAnchor トラスト・ストアはデフォルトのバインディングで定義されています。 ただし、要求受信側の暗号化情報は、アプリケーション・レベルのバインディング (同じ ibm-webservices-bnd.xmi ファイル) で定義された SampleReceiverEncryptionKeyLocator 鍵ロケーターを参照します。 応答送信側は、デフォルトの鍵ロケーター (com.ibm.wsspi.wssecurity.config.CertInRequestKeyLocator) のいずれか 1 つのインプリメンテーションを使用して応答を暗号化する場合、 要求のデジタル・シグニチャーの署名者鍵を使用するよう構成されています。
例 4: サーバーの IBM 拡張バインディングのサンプル
<?xml version="1.0" encoding="UTF-8"?> <com.ibm.etools.webservice.wsbnd:WSBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.etools.webservice.wsbnd= http://www.ibm.com/websphere/appserver/schemas/5.0.2/wsbnd.xmi"> <wsdescBindings wsDescNameLink="MyServ"> <pcBindings pcNameLink="Port1" scope="Session"> <securityRequestReceiverBindingConfig> <signingInfos> <signatureMethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <certPathSettings> <trustAnchorRef ref="SampleServerTrustAnchor"/> <certStoreRef ref="SampleCollectionCertStore"/> </certPathSettings> <canonicalizationMethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <digestMethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> </signingInfos> <encryptionInfos name="EncInfo1"> <encryptionKey locatorRef="SampleReceiverEncryptionKeyLocator"/> <encryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <keyEncryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/> </encryptionInfos> <keyLocators name="SampleReceiverEncryptionKeyLocator" classname= "com.ibm.wsspi.wssecurity.config.KeyStoreKeyLocator"> <keyStore storepass="{xor}LCswLTovPiws" path="$${USER_INSTALL_ROOT}/ etc/ws-security/samples/enc-receiver.jceks" type="JCEKS"/> <keys alias="Group1" keypass="{xor}NDomLz4sLA==" name="CN=Group1"/> <keys alias="bob" keypass="{xor}NDomLz4sLA==" name="CN=Bob, O=IBM, C=US"/> </keyLocators> </securityRequestReceiverBindingConfig> <securityResponseSenderBindingConfig> <signingInfo> <signatureMethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <signingKey name="serversignerkey" locatorRef="SampleServerSignerKey"/> <canonicalizationMethod algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <digestMethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> </signingInfo> <encryptionInfo name="EncInfo2"> <encryptionKey locatorRef="SignerKeyLocator"/> <encryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <keyEncryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/> </encryptionInfo> <keyLocators name="SignerKeyLocator" classname= "com.ibm.wsspi.wssecurity.config.CertInRequestKeyLocator"/> </securityResponseSenderBindingConfig> </pcBindings> </wsdescBindings> <routerModules transport="http" name="StockQuote.war"/> </com.ibm.etools.webservice.wsbnd:WSBinding>