前のトピック: リスク評価の実行次のトピック: 関連付けの管理


リスクの評価および事後評価の実行

トランザクションに関連付けられたリスクを評価し、それに続く事後評価を実行するには、RiskXActionAPI インターフェース(com.arcot.riskfortAPI パッケージで)を使用する必要があります。 このインターフェースは RiskMinder サーバのリスク評価機能に接続するクライアント側インターフェースを表し、リスク評価ワークフロー用のサポートされている API を提供します。

トランザクションのリスクを評価して事後評価タスクを実行する方法

  1. RiskFactory クラスを使用することによって Risk Evaluation API が初期化されていることを確認します。

    詳細については、「事前準備」の「リスク評価 API の初期化」を参照してください。

  2. 必要に応じて、com.arcot.riskfortAPI.AdditionalInputs パッケージ内に AdditionalInputs クラスを使用することによって、トランザクションに追加の入力を準備します。

    詳細については、「事前準備」の「追加入力の準備」を参照してください。

  3. RiskFactory.getRiskXActionAPI() 静的メソッドを使用して RiskXActionAPI インターフェースを実装するオブジェクトを取得します。

    このメソッドは、RiskFactory API の初期化の一環として作成される RiskXActionAPI オブジェクトを返します。

  4. RiskXActionAPI.evaluateRisk() メソッドを使用して RiskAssessment クラスのオブジェクトを取得します。

    このメソッドには以下の入力パラメータが必要です。

    1. 呼び出し全体の追跡に使用される CallerID 文字列変数を定義して設定します。
    2. デバイス ID および DeviceDNA の収集」の説明に従い、構築する JSON シグネチャを構築するために DeviceContext オブジェクトを使用して、buildDeviceSignature() メソッドを呼び出します。
    3. LocationContext オブジェクトを作成し、LocationContext オブジェクトの setIpAddress() メソッドを呼び出して、IP アドレスをユーザのシステムの IP アドレスに設定します。
    4. UserContext オブジェクトを作成し、UserContext オブジェクトの setUserID() メソッドを使用して、ユーザの一意の ID を設定します。
    5. TransactionContext オブジェクトを作成し、必要に応じて、このクラスのメソッド(setAction() と setChannel())を使用して、返されたオブジェクトの必要なプロパティを設定します。
    6. 追加情報を使用している場合は、手順 2 で作成した AdditionalInputs オブジェクトを使用します。AdditionalInputs.put(name,value) メソッドを使用して、返されたオブジェクトの必要なプロパティを設定します。 2.

      これらの追加入力は、名前と値のペアの形式です。 以下に例を示します。

      MerchantID=id;MerchantCountry=country;MerchantName=name

  5. RiskAssessment.getRiskAdvice() メソッドを使用して RiskAssessment RiskAdvice オブジェクトの結果を取得します。

    重要: アドバイスが INCREASEAUTH の場合、アプリケーションは 2 次認証を実行し、PostEvaluate() メソッドを使用して、この認証の結果を RiskMinder に渡す必要があります

  6. 最後に、RiskXActionAPI.postEvaluate() メソッドを使用してトランザクションの最終結果を特定し、PostEvaluateResponse オブジェクトを返します。

    postEvaluate() メソッドはユーザのデバイス シグネチャ情報を更新し、変更されている場合、必要に応じて、ユーザとデバイスの関連付けを作成または更新します。

    何らかの操作を行った場合は、2 次認証の結果をメソッドに渡す必要があります。

  7. PostEvaluateResponse.isAllowAdvised() メソッドを使用して、以下の目的のために、 PostEvaluateResponse オブジェクトの結果をクエリできます。

エラー処理

いずれかのリスク評価 API メソッドの実行中にエラーが発生した場合、以下の 2 つの例外のいずれかがスローされます。

リスク評価および事後評価のためのサンプル コード

注: 詳細な実用コードのサンプルについては、付録「リスク評価および事後評価のためのサンプル コード」を参照してください。

以下のサンプル コード スニペットを使用して、アプリケーション コードに RiskMinder のリスク評価および事後評価機能を実装する方法を理解してください。

public static void sampleCode() {
        String propertyLocation= "/properties/riskfort.risk-evaluation.properties";
        try {
             RiskFactory.initialize(propertyLocation);
             RiskXActionAPI riskXActionAPI = RiskFactory.getRiskXActionAPI();
             String callerId;
             UserContext userContext = new UserContext();
             LocationContext locationContext = new LocationContext();
             DeviceContext deviceContext = new DeviceContext();
             TransactionContext transactionContext = new TransactionContext();
             AdditionalInputs additionalInputs = new AdditionalInputs();
            
             // string used by the calling application for tracking across
              // calls
             callerId="MyApplicationTrackingId";
            
             // Unique identifier for the user. In case of a Bank it may be
              // user's bank account number
             // It may be name of the user in some other case.
             userContext.setUserId("USER1");
            
             // IP address of the user's machine, typically, extracted from
              // the HTTP header
             locationContext.setIpAddress(InetAddress.getByName("10.150.1.1"));
            
             // JSON Signature comes from mfp_json.js, in this example the
              // signature is hard coded
             // for the sample use.
             String jsonSignature = "{\"navigator\":{\"platform\":\"Win32\",\"appName\":\"Netscape\",\"appCodeName\":\"Mozilla\",\"appVersion\":\"5.0 (Windows; en-US)\",\"language\":\"en-US\",\"oscpu\":\"Windows NT 5.0\",\"vendor\":\"\",\"vendorSub\":\"\",\"product\":\"Gecko\",\"productSub\":\"20070312\",\"securityPolicy\":\"\",\"userAgent\":\"Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11\",\"cookieEnabled\":true,\"onLine\":true},\"plugins\":[{\"name\":\"Adobe Acrobat Plugin\",\"version\":\"7.00\"},{\"name\":\"Macromedia Director\",\"version\":\"10.1\"},{\"name\":\"Windows Media Player Plug-in Dynamic Link Library\",\"version\":\"\"},{\"name\":\"Macromedia Shockwave Flash\",\"version\":\"9.0\"},{\"name\":\"Java Virtual Machine\",\"version\":\"1.6.0\"}],\"screen\":{\"availHeight\":690,\"availWidth\":1024,\"colorDepth\":32,\"height\":768,\"pixelDepth\":32,\"width\":1024},\"extra\":{\"javascript_ver\":\"1.6\",\"timezone\":-330}}";
             deviceContext.buildDeviceSignature(jsonSignature,null,null);
             String userDeviceId="GPXp+4e0hzzxzh6YLlPZqKgXCGbBXB8E0ghZnFXHq8o3HLRaww6c4g==";
             // The device id collected from the user machine
             deviceContext.setDeviceID("HTTP_COOKIE", userDeviceId);
            
             // Providing the addition inputs.
             additionalInputs.put("MerchantID","id") ;
             additionalInputs.put("MerchantCountry","country") ;
             additionalInputs.put("MerchantName","name") ;
            
             transactionContext.setAction("Login");
             RiskAssessment riskAssessment=null;
             riskAssessment = riskXActionAPI.evaluateRisk(callerId , deviceContext, locationContext , userContext, transactionContext, additionalInputs);
             boolean secondaryAuthenticationStatus = true;
             String associationName = "USER1inHomePC";
            
             if (riskAssessment.getRiskAdvice().equals(RiskAssessment.RISK_ADVICE_INCREASEAUTH)) {
                         // then you may ask for secondary authentication
                         //if( secondaryAuthentication succeeded )
                         //          secondaryAuthenticationStatus = true;
                         //else
                         //          secondaryAuthenticationStatus = false
             }
            
             PostEvaluateResponse postEvaluateResponse =
                         riskXActionAPI.postEvaluate(callerId, riskAssessment,
                                                                         secondaryAuthenticationStatus, associationName);
             if( postEvaluateResponse.isAllowAdvised() ) {
                         //Allow the transaction to be completed
             }
             else {
                             //Deny and terminate the transaction
             }
            
             } catch (IOException e) {
            //Looks like the property file location is not valid
                e.printStackTrace();
             } catch (RiskException e) {
                //One of the RiskFort API calls broke
                e.printStackTrace();
             }
}