SOAP Authentication Wrapper Code Sample for Java: Secure Channel Authentication
  • 10 Dec 2024
  • 1 Minute à lire
  • Sombre
    Lumière
  • PDF

SOAP Authentication Wrapper Code Sample for Java: Secure Channel Authentication

  • Sombre
    Lumière
  • PDF

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

The Secure Channel authentication consists of two steps:

  • Getting secure challenge
  • Authenticating user

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

To use Secure Channel authentication, add a client component (Authentication with Secure Channel Sample Client) with the Identikey Authentication with Secure Channel policy and configure the SDK as described here to use this component for Secure Channel authentication.

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

component.type.authentication.secure_channel = Authentication with Secure Channel Sample Client

Code sample: Getting secure challenge

<%@ page import="com.vasco.identikey.model.Credentials" %>
<%@ page import="com.vasco.identikey.controller.IdentikeyError" %>
<%@ page import="com.vasco.identikey.controller.authentication.AuthenticationCommandResponse" %>
<%@ page import="org.w3._2001.xmlschema.UnsignedInt" %>

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

<%
    // Authentication details have been provided, now perform the request
    String userID = request.getParameter("CREDFLD_USERID");
    String domain = request.getParameter("CREDFLD_DOMAIN");
    String serialNo = request.getParameter("SIGNFLD_SERIAL_NO");
    String challengeMessage = request.getParameter("CREDFLD_CHALLENGE_MESSAGE");
    String transactionTitle = request.getParameter("CREDFLD_TRANSACTION_TITLE");
    String requestBody = request.getParameter("CREDFLD_REQUEST_BODY");

    // Execute getSecureChallenge command
    AuthenticationCommandResponse results = authenticationBean.getSecureChallenge(userID, domain, serialNo, challengeMessage, transactionTitle, requestBody);

    if (results.getReturnCode() == 0) {
        Credentials credentials = results.getResults();
        String requestMessage = credentials.getRequestMessage();
        String challengeKey = credentials.getChallengeKey();
    }
%>

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

Code sample: Authenticating user

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

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

<%
    String userID = request.getParameter("CREDFLD_USERID");
    String domain = request.getParameter("CREDFLD_DOMAIN");
    String challengeKey = request.getParameter("CREDFLD_CHALLENGE_KEY");
    String requestSignature = request.getParameter("CREDFLD_PASSWORD");

    // Execute the command
    AuthenticationCommandResponse results = authenticationBean.authUser(domain, userID, challengeKey, requestSignature);

    if (results.getReturnCode() == 0) {
        // Secure challenge authentication succeeded.
        Credentials credentials = results.getResults();
    }
%>

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

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