Updating a JavaScript to challenge a user

If the
evaluateRisk API
call considers a user access event risky, VIP IA then recommends further authentication. In this case, you may elect to present the user with a "challenge" page to authenticate the access attempt, based on your own challenge method.
IA Integration with web pages for sign-in shows an example flow of how you can integrate with a page that serves to challenge user authentication.
If the device from which the users sign in is unrecognized (different from the device pattern that is established within the user's profile), you can prompt the user to decide whether the device should be recognized ("remembered") for future access events. For example, if you use a check box as your prompt and the user selects the check box, the device stores a browser tag (
writeTag()
) in the user's browser.
To pass the result from the evaluateRisk API call to the user's browser, you can use the hidden input parameter containing its value. If the user elects to be remembered on the particular device, a
writetag()
needs to be invoked.
<!-- Include VIP IA JavaScript Library --> <script type="text/javascript" src="https://userservices.vip.symantec.com/ vipuserservices/static/v_1_0/scripts/iadfp_1.3.js"></script> <%-- Based on the evaluateRiskResult, if the device is not registered, show Remember this Device option --%> <s:if test="evaluateRiskResults.get(‘device.registered’) == ‘false’"> <input type="check box" id="rememberDevice" name="rememberDevice" value="true" /> Remember this device?<br /> <input type="hidden" id="tag" value="<s:property value="evaluateRiskResults.get(‘device.tag’)"/>" /><br /> </s:if>
Upon submit, you can invoke the
IaDfp.writeTag()
function as shown in the following sample. This JavaScript function writes the tag into the user's browser. The updated device fingerprint is set in the hidden device fingerprint.
<script type="text/javascript"> function rememberTag() { var tag = document.getElementById(‘tag’); var remember = document.getElementById(‘rememberDevice’); if (tag && remember) { IaDfp.writeTag(tag.value, remember.checked); } document.getElementById(‘deviceFingerprint’).value = IaDfp.readFingerprint(); } </script> <s:form action="submitChallengeResponse" method="post" onsubmit= "rememberTag();"> <input type="hidden" id="deviceFingerprint" name="deviceFingerprint" value="" /> </s:form>