To evaluate the risk associated with a transaction and to perform the subsequent post-evaluation, you need to use the RiskXActionAPI interface (in the com.arcot.riskfortAPI package. This interface represents the client-side interface to RiskMinder Server’s risk evaluation functionality and exposes the supported API for risk evaluation workflows.
To evaluate risk of a transaction and perform post-evaluation tasks:
See "Initializing the Risk Evaluation API" in "Before You Begin" for more information.
See "Preparing Additional Inputs" in "Before You Begin" for more information.
This method returns the RiskXActionAPI object created as a part of the RiskFactory API initialization.
This method requires the following input parameters:
These are additional inputs in form of name-value pairs. For example:
MerchantID=id;MerchantCountry=country;MerchantName=name
Important! If the advice is INCREASEAUTH, then your application must perform secondary authentication and pass the result of this authentication to RiskMinder by using the PostEvaluate() method.
The postEvaluate() method updates the Device Signature information for the user, if it changed and creates or updates user-device associations, if required.
You will need to pass the result of secondary authentication to the method, if you performed any.
Any errors that occurred during the execution of any of the Risk Evaluation API methods can result in one of the following two exceptions being thrown:
Note: Refer to "Sample Code for Risk Evaluation and Post-Evaluation" in appendix for a detailed working code sample.
You can use the following sample code snippet to understand how to implement the risk evaluation and post-evaluation capability of RiskMinder in your application code.
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 © 2013 CA.
All rights reserved.
|
|