jms-Listener Sample
This sample java application demonstrates how an application can wait for a Device registration result, or Action/Logon Validation request result, by listening JMS messages on the ActivID JMS topics.
See JMS Notifications Message Format for details of the messages published on the JMS topic by ActivID Appliance.
This sample:
-
Starts listening on the ActivID Appliance corresponding JMS topic.
-
Displays device registrations and logon/action validation resulting JMS messages.
Prerequisites
Define the Sample Push-Based Client Application for ActivID Appliance
-
Define a new application name (for example, CLIENT1).
-
Generate a .jks file with a client certificate and private key for your push-based application instance (required for secure connection to the appliance JMS topic broker server).
-
Copy the corresponding certificate to a file (required to define the client push-based application instance as illustrated below).
-
Register your application using the Push-based Authentication configuration menu in the ActivID Console.
-
Use the client certificate to define your push application instance.
-
Add the root CA certificate of your client application certificate to the ActivID Appliance trusted certificates.
-
Restart the ActivID Appliance applications to reload the JMS push applications configuration.
The result is a new JMS topic with name CLIENT1 that can be used to post the result of HID Approve device activation or HID Approve logon or action validation.
See the following section to configure the ActivID Appliance server to post result on the new application.
Configure ActivID Appliance to Post Result on the Application JMS Topic
-
To receive JMS notification messages for HID Approve application Logon or Action validation approval:
Make sure that the topic name for your application is configured as the Application Topic Identifier value in the attributes of the application’s Direct user (for example, spl-api) used to request logon or action.
-
To receive JMS notification messages for HID Approve application service registration:
Define or update the adapter configuration for Device registration feedback Notification.
Update JMS Topic name to post the notification parameter with the topic name for your application.
In the ActivID Management Console, go to the Configuration tab and, under Environment, select Adapters:
Installation
-
Unzip the Push_Authentication_Sample\JMS-client-listener-sample.zip file to the destination of your choice (for example, a jmslistener-sample folder).
Refer to the Readme-jms-listener-sample.txt for details.
Sample content:
-
Edit the jmsListener.properties file in the config folder and configure the following entries:
- jmsBrokerURI – the URI for your server ActiveMQ broker (for example, ssl://myserver:1004).
-
keystore_path – the full path to the .jks key store file that contains PKI client certificate and private key of your JMS Push application instance (for example, keystore_path=C:/myfolder/keystore.jks).
-
keystore_password – the password of the key store.
-
jmsTopic – the JMS topic name of your push application (for example, CLIENT1).
Run the jms-Listener Sample
-
Open a command window and change the directory to the scripts folder.
-
Run one of the following commands:
-
On Microsoft Windows, use
JMSListener.bat
-
On Linux, use
JMSListener.sh
-
The script will output to the HIDSample.log:
-
The received JMS messages for HID Approve service registration are similar to:
Copy2017-03-23 18:01:03 ========== Text message received: action=activation;domain=ONLINEBANK;usercode=user1;deviceid=11063;response=success
-
The received JMS messages for Logon or Action operation validation are similar to:
Copy2017-03-23 18:01:03 ========== Text message received: action=opvalidation;domain=ONLINEBANK;usercode=user1;deviceid=11063;success=1;reason=Reason not defined;correlationid=12345678;clientapprovalstatus=accept;