メッセージング・エンジンに接続するユーザーの許可

認証されたユーザーに、メッセージの送受信や表示を行うためにメッセージング・リソース (キューまたはトピック) にアクセスするための十分な許可があるかどうかを検証する必要があります。

手順

  1. server.xml ファイルで wasJmsSecurity-1.0 フィーチャーを使用可能にします。
    <featureManager>
    	<feature>wasJmsServer-1.0</feature>
    	<feature>wasJmsClient-2.0</feature>
    	<feature>wasJmsSecurity-1.0</feature>
    </featureManager>
  2. server.xml ファイル内に <messagingSecurity> エレメントを 構成して、各ユーザーのロールおよび許可を定義します。これによって、ユーザーがメッセージング・リソース に対して実行できるアクションが特定されます。
    宛先に対する許可は <messagingSecurity> エレメントで定義できます。以下にサンプル構成を示します。
    <messagingEngine>
      <queue id="QUEUE1"/>
      <topicSpace id="TopicSpace1"/>
    
     <messagingSecurity>
        <role name="developer">
            <queuePermission queueRef="QUEUE1">
    		<action>SEND</action>
    		<action>BROWSE</action>
            </queuePermission>
    		
    	<topicPermission topicSpaceRef="TopicSpace1" topicName="Sports/Cricket">
    		<action>ALL</action>
    	</topicPermission>
    
            <user name="user1" />
            <user name="user3" />
            <group name="Developers" />
        </role>
       
        <role name="tester">
            <queuePermission queueRef="QUEUE1">
    		<action>BROWSE</action>
    	</queuePermission>
    		
    	<topicPermission topicSpaceRef="TopicSpace1">
    		<action>RECEIVE</action>
    	</topicPermission>
        
            <user name="user5" />
            <user name="user6" />
            <group name="Testers" />
        </role>
      </messagingSecurity>
    </messagingEngine>
    上記の構成では、 ユーザー user1 および user3 と グループ Developers は、 QUEUE1SEND アクションおよび BROWSE アクション を実行できます。さらに、TopicSpace1 内の Sports/Cricket トピックで ALL (すべての) アクションを 実行できます。 同様に、ユーザー user5 および user6 と グループ Testers は、キュー QUEUE1BROWSE アクション を実行でき、TopicSpace1 内のすべてのトピックで RECEIVE アクション を実行できます。
  3. オプション: メッセージング・エンジンに接続する場合は、 createConnection 呼び出しにユーザー名とパスワードを指定します。
    構文は次のとおりです。
    [createConnection(userName, password)]
    認証されたユーザーとしてメッセージング・エンジンに接続し、 管理者によって宣言された許可権限に基づいた操作を実行します。

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

ファイル名: twlp_msg_sec_authorize.html