SOAP Signature Wrappers
  • 21 Jan 2025
  • 2 Minutes à lire
  • Sombre
    Lumière
  • PDF

SOAP Signature Wrappers

  • Sombre
    Lumière
  • PDF

The content is currently unavailable in French. You are viewing the default English version.
Résumé de l’article

The SOAP signature wrapper maps all commands defined in the OneSpan Authentication Server signature WSDL file in a class called SignatureBean.

For the signature object, the IdentikeyResponse class is extended to a SignatureResponse class. For a list of different methods defined by this class, see Overview of SOAP wrappers.

SOAP signature wrapper code samples for Java: Standard signature

Below are code samples that need to be included in the webpages where the OneSpan Authentication Server standard signature functionality is to be integrated.

<%@ page import="com.vasco.identikey.model.Signature" %>
<%@ page import="com.vasco.identikey.controller.IdentikeyError" %>
<%@ page import="com.vasco.identikey.controller.signature.SignatureCommandResponse" %>
<%@ page import="org.w3._2001.xmlschema.UnsignedInt" %>

// Signature details have been provided, now perform the request
<%
  String userID = request.getParameter("SIGNFLD_USERID");
  String domain = request.getParameter("SIGNFLD_DOMAIN");
  String signature = request.getParameter("SIGNFLD_SIGNATURE");
  
  Boolean rcc = Boolean.valueOf("on".equals(request.getParameter("SIGNFLD_REQUEST_CONFIRM_CODE")));
  
  java.util.List<String> fields = new java.util.ArrayList();
  fields.add(request.getParameter("SIGNFLD_DATA_FIELD_1"));
  fields.add(request.getParameter("SIGNFLD_DATA_FIELD_2"));
  fields.add(request.getParameter("SIGNFLD_DATA_FIELD_3"));
  fields.add(request.getParameter("SIGNFLD_DATA_FIELD_4"));
  fields.add(request.getParameter("SIGNFLD_DATA_FIELD_5"));
  fields.add(request.getParameter("SIGNFLD_DATA_FIELD_6"));
  fields.add(request.getParameter("SIGNFLD_DATA_FIELD_7"));
  fields.add(request.getParameter("SIGNFLD_DATA_FIELD_8"));
  
  java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
  java.util.Date deferredTime = null;
  
  try {
    String s = request.getParameter("SIGNFLD_DEFERRED_DATETIME");
    if (s != null && !"".equals(s)) {
      deferredTime = format.parse(s);
    }
  } catch(Exception e) {}
  
  UnsignedInt deferredEvent = null;
  try {
    deferredEvent = new UnsignedInt(Integer.parseInt(request.getParameter("SIGNFLD_DEFERRED_EVENT_VALUE")));
  } catch(Exception e) {}
  
  Signature.RequestConfirmationCode reqConfCode = rcc ? Signature.RequestConfirmationCode.Required : Signature.RequestConfirmationCode.Optional;

  // Execute the command
  SignatureCommandResponse results = signatureBean.authSignature(domain, userID, signature, fields, deferredTime, deferredEvent, reqConfCode);
  
  if (results.getReturnCode() == 0) {
    // Success
  }
%>

SOAP signature wrapper code samples for Java: Secure channel signature

The Secure Channel signature consists of two steps:

  • Getting signing request
  • Authenticate signature

Below are code samples that need to be included in the webpages where the OneSpan Authentication Server Secure Channel signature functionality is to be integrated.

To use Secure Channel signature, add a client component (Signature Secure Channel Sample Client) with the IDENTIKEY Signature Validation with Secure Channel policy and configure the SDK as described here to use this component for Secure Channel signature.

To use Secure Channel signature, the following code element must be set in the controller.properties file:

component.type.signature.secure_channel = Signature Secure Channel Sample Client

Code sample: Getting signing request

<%@ page import="com.vasco.identikey.model.Signature" %>
<%@ page import="com.vasco.identikey.controller.IdentikeyError" %>
<%@ page import="com.vasco.identikey.controller.signature.SignatureCommandResponse" %>

<jsp:useBean id="signatureBean" class="com.vasco.identikey.controller.signature.SignatureBean" scope="session" />

<%
  // Signature details have been provided, now perform the request
  String userID = request.getParameter("SIGNFLD_USERID");
  String domain = request.getParameter("SIGNFLD_DOMAIN");
  String serialNo = request.getParameter("SIGNFLD_SERIAL_NO");
  String requestBody = request.getParameter("SIGNFLD_REQUEST_BODY");
  String transactionTitle = request.getParameter("SIGNFLD_TRANSACTION_TITLE");

  // Create a LinkedHashMap to hold the data fields
  java.util.LinkedHashMap<String, String> dataFields = new java.util.LinkedHashMap();
  dataFields.put(request.getParameter("SIGNFLD_DATA_FIELD_KEY1"), request.getParameter("SIGNFLD_DATA_FIELD_VAL1"));

  if (request.getParameter("SIGNFLD_DATA_FIELD_KEY2") != null && request.getParameter("SIGNFLD_DATA_FIELD_VAL2") != null) {
    dataFields.put(request.getParameter("SIGNFLD_DATA_FIELD_KEY2"), request.getParameter("SIGNFLD_DATA_FIELD_VAL2"));
  }

  if (request.getParameter("SIGNFLD_DATA_FIELD_KEY3") != null && request.getParameter("SIGNFLD_DATA_FIELD_VAL3") != null) {
    dataFields.put(request.getParameter("SIGNFLD_DATA_FIELD_KEY3"), request.getParameter("SIGNFLD_DATA_FIELD_VAL3"));
  }

  if (request.getParameter("SIGNFLD_DATA_FIELD_KEY4") != null && request.getParameter("SIGNFLD_DATA_FIELD_VAL4") != null) {
    dataFields.put(request.getParameter("SIGNFLD_DATA_FIELD_KEY4"), request.getParameter("SIGNFLD_DATA_FIELD_VAL4"));
  }

  // Execute the genRequest command
  SignatureCommandResponse results = signatureBean.genRequest(userID, domain, serialNo, requestBody, transactionTitle, dataFields);

  if (results.getReturnCode() == 0) {
    // Success, retrieve results
    Signature sig = results.getResults();
    userID = sig.getUserID();
    domain = sig.getDomain();
    String requestKey = sig.getRequestKey();
  }
%>

<!-- Generate cronto image from RequestMessage -->
<img id="crontoImage" class="image-centered" alt="Request Message" title="Request Message" src="data:image/png;base64,<%= sig.getRequestMessageImage(6) %>"/>

Code sample: Authenticating signature

<%@ page import="com.vasco.identikey.model.Signature" %>
<%@ page import="com.vasco.identikey.controller.IdentikeyError" %>
<%@ page import="com.vasco.identikey.controller.signature.SignatureCommandResponse" %>

<jsp:useBean id="signatureBean" class="com.vasco.identikey.controller.signature.SignatureBean" scope="session" />

<%
  String userID = request.getParameter("SIGNFLD_USERID");
  String domain = request.getParameter("SIGNFLD_DOMAIN");
  String requestKey = request.getParameter("SIGNFLD_REQUEST_KEY");
  String signature = request.getParameter("SIGNFLD_SIGNATURE");

  // Execute the command
  SignatureCommandResponse results = signatureBean.authSignature(domain, userID, signature, requestKey);

  if (results.getReturnCode() == 0) {
    // Secure channel signature verification succeeded.
    Signature sig = results.getResults();
  }
%>

Cet article vous a-t-il été utile ?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Ozzy, facilitant la découverte de connaissances grâce à l’intelligence conversationnelle