トランザクションに関連付けられたリスクを評価し、それに続く事後評価を実行するには、RiskXActionAPI インターフェース(com.arcot.riskfortAPI パッケージで)を使用する必要があります。 このインターフェースは RiskMinder サーバのリスク評価機能に接続するクライアント側インターフェースを表し、リスク評価ワークフロー用のサポートされている API を提供します。
トランザクションのリスクを評価して事後評価タスクを実行する方法
詳細については、「事前準備」の「リスク評価 API の初期化」を参照してください。
このメソッドは、RiskFactory API の初期化の一環として作成される RiskXActionAPI オブジェクトを返します。
このメソッドには以下の入力パラメータが必要です。
これらの追加入力は、名前と値のペアの形式です。 以下に例を示します。
MerchantID=id;MerchantCountry=country;MerchantName=name
重要: アドバイスが INCREASEAUTH の場合、アプリケーションは 2 次認証を実行し、PostEvaluate() メソッドを使用して、この認証の結果を RiskMinder に渡す必要があります。
postEvaluate() メソッドはユーザのデバイス シグネチャ情報を更新し、変更されている場合、必要に応じて、ユーザとデバイスの関連付けを作成または更新します。
何らかの操作を行った場合は、2 次認証の結果をメソッドに渡す必要があります。
いずれかのリスク評価 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();
}
}
|
Copyright © 2014 CA Technologies.
All rights reserved.
|
|