Generic selectors
Exact matches only
Search in title
Search in content

JAVA API

Two-Factor Authentication with SecSign ID Plugin

Use SecSign ID PHP two factor authentication on your PHP project with an easy and highly secure user login using iOS or Android mobile devices as well as for desktop use.


Find out why our Two-Factor Authentication is the best, some key-facts for developers and why you should upgrade to SecSign for your business.

Learn more about the options of on-premise use and your own customized ID App in your corporate design.

Download the plugin as cloud version for a free and convenient protection.


The SecSign ID is a true two-factor authentication. It was designed as an easy, fast and robust solution which can be easily and quickly integrated into existing projects.

The SecSign ID Java IP can be used to integrate the two-factor authentication in web-applications based on application server like Apache Tomcat, Oracle Glassfish or IBM Websphere, as well as regular Java-Swing-applications or Java-applets.
Also it can be used for integrating the two-factor authentication in web-applications, for example JIRA.

Thus, the Java-API can be used to ensure easy and highly secure user logins with iOS or Android devices.

TWO-FACTOR AUTHENTICATION OVERVIEW

Table of contents

    Start right now! Questions?

    Feel free to get in touch with us if you need help setting up your SecSign ID plugin or to request a plugin for a not yet supported environment.
    CONTACT US

    In our Java-API Zip-Archiv we prepared both ‘SecSignIDApi.jar’ and ‘SecPKIApi.jar’ as well as the source code for the API-class and an example on how to integrate it in a Swing-Application.
    Integration in Java Server-Faces-Applications or Java-Servlets is analog to the Swing-Example. The source code is available on the SecSign GitHub page.

    1. Requirements for the integration

    For the use with a Java-Server-Faces-Application, JavaServer-Pages or a Swing Application the following requirements must be met:

    • Installation of an Application-Server, like Apache Tomcat, Apache Geronimo or Oracle Glassfish
    • Installation of a Java Enterprise Edition Server (J2EE or Java EE)
    • Installation of Java 1.7 EE and the associated GlassFish Server, see “The Java EE 7 Tutorial“.
    • Installation of an up to date Java Runtime Environment (JRE) or Java Development Kit (JDK) from Oracle
    • Embedding the API-Jar in the Java-Class-Path

    Also, the SecSign Java API can be integrated in all projects using OSGi (Open Services Gateway Initiative).

    Projects and Application Server based on OSGi are for example Oracle Weblogic, Atlassian JIRA and Confluence as well as JBoss and open projects like OpenEJB.

    OSGi is an open and hardware-independent platform for modality and is based on Java. By strict definition it is a component model.

    The two-factor authentication can be easily implemented with a modality of Beans using WAR-modules or JAR. A detailed list of projects based on OSGi can be found here.

    2. Integration of the Java-Api

    Download the Java-API Zip-archive and unzip it.

    Both *.jar files have to be added to the Java Project. This can be achieved either with Eclipse in Settings > Java > Build Path > User Libraries or by transferring both .*jar files in the corresponding Java-project folder. Eclipse automatically recognizes the files and integrates them in the project.

    With application server the basis structure determines the process of integration. Oracle Glassfish for example requires the *.jar files to be converted to *.war files before deploying them.

    Import the required class from the package ‘com.secsign.secsignid’in the corresponding class in your project.:

    import com.secsign.secsignid.SecSignIDApi;
    import com.secsign.secsignid.AuthenticationSession;
    import com.secsign.secsignid.AuthenticationSessionState;
    import com.secsign.secsignid.SecSignIDException;

    Overview of the Java-API zip-archive structure:

    README.md
    secsign_logo.png
    developer/
    lib/SecPKIApi.jar
    lib/SecSignIDApi.jar
    lib/secpki.properties
    lib/secsign.com-wildcard-rapidSSL-2014-09-29.der
    src/com/secsign/secsignid/AuthenticationSession.java
    src/com/secsign/secsignid/AuthenticationSessionState.java
    src/com/secsign/secsignid/SecSignIDApi.java
    src/com/secsign/secsignid/SecSignIDException.java
    src/com/secsign/secsignid/example/SecSignIDApiJavaSwingExample.java

    3. Requesting an Authentication-Session

    In order to log a user in a web application or content-management-system (CMS) with his SecSign ID an authentication-session, short AuthSession, has to be requested from the SecSign ID Server. This AuthSession can be accepted from the user on his smart phone, which in turn logs him into the system. To request an AuthSession the method ‘SecSignIDApi.requestAuthenticationSession’ is used.

    // create the SecSignID-API instance which can send requests to the SecSignID server
    SecSignIDApi secSignIdApi = new SecSignIDApi();
    String secSignID = secSignIdTextField.getText();
    AuthenticationSession authSession = null;
    try
    {
    	authSession = secSignIdApi.requestAuthenticationSession(secSignID,
    		"SecSignID Java integration example",
    		"www.example.com",
    		"127.0.0.1");
    }
    catch (SecSignIDException exception)
    {
    	exception.printStackTrace();
    	JOptionPane.showMessageDialog(null, exception.getLocalizedMessage());
    }

    The return value is the object ‘AuthenticationSession’. The class holds all information like SecSign ID, AuthSession ID, the access pass as png-image and the information provided during login.

    The method ‘SecSignIDApi.requestAuthenticationSession’ includes the SecSign ID, which is supposed to be logged in, as a parameter, as well as the name of the web application ( ‘SecSignID Java integration example’ in the example) and an URL.

    The name of the web application is displayed to the user as push notification on the smartphone while the URL is displayed to the user when choosing the access pass.

    java

    java

    4. Display the AccessPass

    The returned object type AuthSession holds all information about received and started AuthSession. This also includes the png-image of the access pass, which is shown to the user. During the AuthSession four access pass are displayed to the user and he has to choose the correct one.

    Depending on the system, servlet or swing-application there are several possibilities to display the access pass.

    Swing Application

    In the example the Swing Application contains a label ‘accessPassImage’. The received access pass will be displayed on this label by loading the byte-array in the imgageicon instance.

    /**The label to show the logo and access pass**/
    private JLabel accessPassImage;
    //etc.
    if (authSession != null){
        // Show the Access Pass
        final byte[] passIcon = session.getAuthSessionIconData();
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                accessPassImage.setIcon(new ImageIcon(passIcon));
            }
        });
    }

    JSF-Application

    In Java-Server-Faces-Web applications data are usually written in HTML-pattern, which are then sent to the browser. Using a XHTML-template objects and class variable can be embedded using

    #{secsignid.iconData}. As soon as the template is rendered, an object ‘secsignid’ is requested that possesses the getter- and setter-method for the variable ‘iconData’.

    /**
     * The iconData of the access pass
     */
    private String iconData;
    try
    {
    	AuthenticationSession authSession = secSignIdApi.requestAuthenticationSession(secSignID,
    		"SecSignID Java integration example",
    		"www.example.com",
    		"127.0.0.1");
    	sessionID = authSession.getAuthSessionID();
    	// this field is read when the xhtm pattern is rendered and the value is inserted at: #{secsignid.iconData}
    	iconData = new BASE64Encoder().encode(authSession.getAuthSessionIconData());
    	log.log(Level.INFO,"Received the authentication session with ID '" + sessionID + "' for SecSignID user ID '" + userId + "'.");
    	return "accesspass?faces-redirect=true"; // go to the page showing the access pass and update the displayed URL in the browser
    }
    catch(SecSignIDException exception)
    {
    	log.log(Level.SEVERE, "Error when requesting an authentication session for SecSignID '" + secSignID + "'", ex);
    }

    5. Requesting the status of the session

    The AuthSession requested by the ID server may have several different statuses.

    To request whether the AuthSession was accepted or declined, or if it is expired, the API method ‘SecSignIDApi.getAuthenticationSessionState’ can be used.

    // Get the State
    AuthenticationSessionState state = null;
    try
    {
    	state = secSignIdApi.getAuthenticationSessionState();
    }
    catch (SecSignIDException exception)
    {
    	exception.printStackTrace();
    }

    6. Reaction to a session status

    It is necessary to react to the user accepting (‘AUTHENTICATED’) or denying (‘DENIED’) the session. The session can either be accepted, denied or remain in a state of uncertainty (‘PENDING’ or ‘FETCHED’).

    The status can be compared to the constant from the class ‘AuthenticationSessionState’. If the session is accepted by the user he can be logged in to the underlying system or web application.

    switch (state.getAuthSessionState()) {
    	case AuthenticationSessionState.FETCHED:
    	case AuthenticationSessionState.PENDING:
    	{
    		msg = "The session is still pending. Please accept the session in the SecSignApp on your smart phone.";
    		break;
    	}
    	case AuthenticationSessionState.DENIED:
    	{
    		msg = "The session has been denied on the smart phone.";
    		checkForState = false;
    		break;
    	}
    	case AuthenticationSessionState.AUTHENTICATED:
    	{
    		try
    		{
    			secSignIdApi.releaseAuthenticationSession();
    		} catch (SecSignIDException exception)
    		{
    			exception.printStackTrace();
    		}
    		msg = "Successfully Authenticated SecSign ID ""+state.getAuthenticatedSecSignId()+""";
    		checkForState = false;
    		break;
    	}
    //etc.
    }

    7. Cancelling an authentication session

    If the user or the client want to cancel the login process, the method ‘SecSignIDApi.cancelAuthenticationSession’ is used.

    A new login with the same SecSign ID API instance can be implemented after that.

    try
    {
    	secSignIdApi.cancelAuthenticationSession();
    }
    catch (SecSignIDException exception)
    {
    	exception.printStackTrace();
    }

    8. Overview

    SECSIGN API CLASSES

    The zip archive includes the folder ‘developer’, which contains the JavaDoc about the SecSign ID Java API classes.

    Constructor and Description

    • SecSignIDApi() – Constructor of the SecSign ID API bean
    • SecSignIDApi(java.lang.String idServer, int idServerPort)
    • requestAuthenticationSession(java.lang.String secSignID, java.lang.String serviceInfo, java.lang.String serviceAddress)
    • getAuthenticationSessionState()
    • cancelAuthenticationSession()
    • releaseAuthenticationSession()

    SECSIGN AUTHENTICATION SESSION

    • byte[] getAuthSessionIconData()
    • long getAuthSessionID()
    • java.lang.String getRequestingServiceAddress()
    • java.lang.String getRequestingServiceName()
    • java.lang.String getSecSignID()
    • void setAuthSessionIconData(byte[] authSessionIconData)
    • void setAuthSessionID(long authSessionId)
    • void setRequestingServiceAddress(java.lang.String requestingServiceAddress)
    • void setRequestingServiceName(java.lang.String requestingServiceName)
    • void setSecSignID(java.lang.String secSignId)

    9. Available APIS

    We provide an ever growing list of APIs and plugins to easily integrate the SecSign ID Two-Factor Authentication in any project. An overview is available at Plugin and APIs.
    We do not only offer APIs in different programming languages but also plugins for CMS, Server and VPN environments, oAuth2 and many more. These plugins use our APIs and offer additional functionalities, for example user management, easy and native installation, logging or integration in firewalls or Active Directory.

    The JIRA plugin for example uses the JAVA-API. The PHP-Api and JS-API is used by WordPress, Joomla, Drupal, Typo3 and many more. The ASP.net/C#-API is used for the Windows and Cisco VPN and the C-API is used for protecting Unix SSH services. The Objective-C API is used by our AppleTV and iPhone/iPad apps.

    available_apis

    10. See for yourself

    You can experience the SecSign ID two-factor authentication and the two-factor login by simply integrating the plugin into your website or test environment. Or you can try out the login process on our website without having to register first. You already have a SecSign ID or you want one? Login now and use the portal or use our hassle free registration.

    See for yourself how fast and convenient the login process using challenge-response authentication with 2048-bit key pairs is. There is no need for passwords, and no passwords or other confidential information are ever transmitted. It is easy to integrate and simple to use.

    For more information about the patented SafeKey procedure and it's unique security can be found here.

    If you are missing an API for the programming language you are working with, feel free to contact us and we’ll find a solution with you. If you need help with the integration into an existing system or you can’t find the plugin for your content management system you are working with, don’t hesitate to contact our support team.

    Your own ID-Server

    On premise installations of SecSign ID offer the flexibility to connect with your preferred servers, services, and devices. And you can customize the SecSign ID with your own organization’s branding.

    your_own_id

    Why upgrade to SecSign?

    On-premise or in the cloud

    Choose between our SecSign ID Cloud or operate your own on-premise Two-Factor Authentication server.

    Easy customization

    Operate your own YourBrand ID app - Two-Factor Authentication customized to your needs.

    Ready-to-use SDK

    Integrate SecSign ID Two-Factor Authentication in existing apps with our ready-to-use SDK.

    Easy user management

    Use the Two-Factor Authentication Server to secure your company Active Directory/LDAP. Your own Identity and Access Management System, for example for mandatory updates and additional security features.

    Cover all logins

    Integration in any login environment: web, local, VPN, remote desktop, mobile logins and many more.

    Plugins for all your needs

    No need for complex integration: we have plugins for almost all environments.

    SecSign 2FA