- 10 Dec 2024
- 1 Minute à lire
- SombreLumière
- PDF
SOAP Authentication Wrapper Code Sample for Java: Secure Channel Authentication
- Mis à jour le 10 Dec 2024
- 1 Minute à lire
- SombreLumière
- PDF
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();
}
%>