SSL 通信を使用した JAX-RS 2.0 リソースの保護

 Secure Sockets Layer (SSL) トランスポート層セキュリティーを使用することにより、JAX-RS 2.0 リソースを保護できます。

始める前に

このタスクでは、以下のステップが完了していることを前提としています。
  • アプリケーション・サーバーに対して、またはネットワーク・デプロイメント・マネージャーに統合されたアプリケーション・サーバーに対して、セル・プロファイルを定義済みである。 セル・プロファイルの作成に関する説明を参照し、フェデレーテッド・アプリケーション・サーバー・ノードとデプロイメント・マネージャーを含むセル・プロファイルを作成する方法を学習した。
  • JAX-RS 2.0 アプリケーションをアプリケーション・サーバーにインストール済みである。

このタスクについて

このタスクの目的は、web.xml ファイルを構成することで JAX-RS 2.0 サーバー・サイドを保護する場合の手順を示すことです。

手順

  1. WebSphere® Application Server traditional 管理コンソールで管理セキュリティーおよびアプリケーション・セキュリティーを有効にします。

    「セキュリティー」->「グローバル・セキュリティー」を選択します。「グローバル・セキュリティー」パネルで、「管理セキュリティー」フィールドの「管理セキュリティーを有効にする」ボックスおよび「アプリケーション・セキュリティー」フィールドの 「アプリケーション・セキュリティーを使用可能にする」ボックスにチェック・マークを付けます。

  2. JAX-RS 2.0 Web アプリケーションを開発します。
  3. web.xml ファイルを構成します。

    JAX-RS リソースを保護するには、user-data-constraint エレメントの下の transport-guarantee サブエレメントを web.xml ファイルに追加し、その値を CONFIDENTIAL に設定します。参考として以下の例を参照してください。

    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-app_3_0.xsd"
    	version="3.0">
    
    	<display-name>Security Test Application</display-name>
    	<description>Server-side application for Security Tests</description>
    
    		<servlet>
    		<servlet-name>com.ibm.ws.jaxrs.security.ssl.SSLApplication
    		</servlet-name>
    		<load-on-startup>1</load-on-startup>
    		</servlet>
    		<servlet-mapping>
    		<servlet-name>com.ibm.ws.jaxrs.security.ssl.SSLApplication
    		</servlet-name>
    		<url-pattern>/ssltest/*</url-pattern>
    		</servlet-mapping>
    
    	<security-constraint id="SecurityConstraint_1">
    		<web-resource-collection id="WebResourceCollection_1">
    			<web-resource-name>com.ibm.ws.jaxrs.security.ssl.SSLApplication
    			</web-resource-name>
    			<description>Protection area for Rest Servlet</description>
    			<url-pattern>/ssltest/ssl/get</url-pattern>
    			<http-method>GET</http-method>
    			<http-method>POST</http-method>
    		</web-resource-collection>
    		<user-data-constraint>  
    			<transport-guarantee>CONFIDENTIAL</transport-guarantee>
    		</user-data-constraint>
    	</security-constraint>
    
    	<login-config>
    		<auth-method>BASIC</auth-method>
    		<realm-name>test</realm-name>
    	</login-config>
    	<security-role id="SecurityRole_1">
    		<description>blabla</description>
    		<role-name>Role1</role-name>
    	</security-role>  
    	<security-role id="SecurityRole_2">
    		<role-name>Role2</role-name>
    	</security-role>  
    	<security-role id="SecurityRole_3">
    		<role-name>AuthenticationRole</role-name>
    	</security-role>  
    </web-app>

タスクの結果

これで、暗号化リソースを呼び出すことができるようになりました。


トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twbs_jaxrs_impl_securejaxrs2
ファイル名:twbs_jaxrs_impl_securejaxrs2.0_serverssl.html