サブ・メッセージ・フローの作成

Security Identity Propagation サンプルの SecurityIdentitySubFlow メッセージ・フローが提供されていますが、メッセージ・フローを独自に作成したい場合には、以下の手順を使用します。

  1. SecurityIdentitySampleFlowProject という新規メッセージ・ブローカー・プロジェクトを作成します。
  2. このプロジェクト内に SecurityIdentitySubFlow という新規メッセージ・フローを作成します。 手順については、WebSphere Message Broker 資料の メッセージ・フローの作成を参照してください。
  3. メッセージ・フロー・エディターで、次の表にリストされているノードを追加して名前変更します。 手順については、WebSphere Message Broker 資料の ノードの追加を参照してください。
    パレット・ドロワー ノード・タイプ ノード名
    Construction Input Input
    Transformation Compute MapIdentity
    HTTP HTTPRequest HTTPRequest_AsID
    Transformation Compute ClrHdrs
    Construction Output Output
  4. 上の表にリストされている順に、ノードを接続します。 手順については、WebSphere Message Broker 資料の ノードの接続を参照してください。
    ノードが正しく接続されたかどうかを確認するには、Security Propagation サンプルについてのダイアグラムを参照してください。
  5. メッセージ・フロー・エディターで、MapIdentity Compute ノードをダブルクリックして、ESQL エディターを開いてください。以下の ESQL コード・モジュールを ESQL ファイルにコピー、および貼り付けし、ファイルを保存します。詳しくは、WebSphere Message Broker 資料の ESQL の開発を参照してください。
    	CREATE FUNCTION Main() RETURNS BOOLEAN
    	BEGIN
    		CALL CopyEntireMessage();
    		-- Set the Mapped Identity if the Input message includes the "flag" 
    		-- to trigger Identity Mapping
    		DECLARE MapIdActionsRef REFERENCE TO InputRoot.XMLNSC.Envelope.Body.MapIdentity;
    		IF lastmove(MapIdActionsRef) THEN
    			-- Create a username and password credential set
    			SET OutputRoot.Properties.IdentityMappedType = 'usernameAndPassword';
    			-- fold Source Username to lowercase
    			DECLARE lusername CHAR;
    			SET lusername = LCASE(InputRoot.Properties.IdentitySourceToken);
    			-- Username token is email address, created from the source username appended with "@company.com"
    			SET OutputRoot.Properties.IdentityMappedToken =  lusername || '@company.com';
    			-- Password is created as the source username prepended with "p_" and appended with current year
    			DECLARE yearStr CHAR;
    			SET yearStr = (EXTRACT(YEAR FROM CURRENT_TIMESTAMP));
    			SET OutputRoot.Properties.IdentityMappedPassword = 'p_' || lusername || yearStr;
    			-- Issuer is this module
    			SET OutputRoot.Properties.IdentityMappedIssuedBy = 'SecurityIdentitySubFlow_MapIdentity';
    		END IF;
    		RETURN TRUE;
    	END;
    	          
  6. メッセージ・フロー・エディターで、ClrHdrs Compute ノードをダブルクリックして、ESQL エディターを開いてください。以下の ESQL コード・モジュールを ESQL ファイルにコピー、および貼り付けし、ファイルを保存します。詳しくは、WebSphere Message Broker 資料の ESQL の開発を参照してください。
    	CREATE FUNCTION Main() RETURNS BOOLEAN
    	BEGIN
    		CALL CopyEntireMessage();
            -- Clear the HTTP request headers from tree
    		SET OutputRoot.HTTPResponseHeader = NULL;
    		RETURN TRUE;
    	END;
              
  7. メッセージ・フローを保存します。

「Security Identity Propagation サンプルの作成」に戻る

サンプルのホームに戻る