SOAP Authentication Wrapper Code Samples for Java: Response-Only

Prev Next

The following code sample shows what you need to include in your webpage if you want to incorporate OneSpan Authentication Server Response-Only authentication.

<%@ page import="com.vasco.identikey.model.Credentials" %>
<%@ page import="com.vasco.identikey.controller.authentication.AuthenticationCommandResponse" %>

<jsp:useBean id="authenticationBean" class="com.vasco.identikey.controller.authentication.AuthenticationBean" scope="page" />

<%
    // Credentials have been provided, now perform the request
    String userID = request.getParameter("CREDFLD_USERID");
    String domain = request.getParameter("CREDFLD_DOMAIN");
    String pin = request.getParameter("CREDFLD_CURRENT_PIN");
    String dpResponse = request.getParameter("CREDFLD_DP_RESPONSE");
    String password = request.getParameter("CREDFLD_STATIC_PASSWORD");
    Boolean rhc = Boolean.valueOf("on".equals(request.getParameter("CREDFLD_REQUEST_HOST_CODE")));
    Credentials.RequestHostCode reqHostCode = rhc ? Credentials.RequestHostCode.Required : Credentials.RequestHostCode.Optional;

    // Execute the command
    AuthenticationCommandResponse results = authenticationBean.authUser(domain, userID, pin, dpResponse, password, reqHostCode);

    if (results.getReturnCode() == 0) {
%>
        <p>OTP Verification Succeeded</p>
<%
    }
%>

If you want to include other functionality, go to the sdk_install_dir/Java/src/SampleSite/src/main/webapp/jsp/authentication folder and use the code from the files in there. All the file names identify the function of the code in the file.