Test Java-based KeyMaster with Liberator
This page explains how to test that the KeyMaster installation, web application server, and Liberator, all work together properly.
This page and its subsections do not apply to KeyMaster.NET. |
Overview
The test involves creating a test HTML page. The web page communicates with KeyMaster, and with Liberator via StreamLink, to authenticate a user.
First check that you have set up KeyMaster according to the steps described in Installing KeyMaster.
In particular make sure that:
-
You have created the encryption keys – see Generate Keys.
-
You have set up the Liberator to accept and validate user credentials tokens created by KeyMaster – see Setting up Liberator to work with KeyMaster.
-
You have deployed the
KeyMaster.war
file – see Installing KeyMaster. -
You have edited the
web.xml
file.
Create a test page
Create a test HTML page (test.html) on your application server with the following contents:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<script type="text/javascript" src="<liberator url>/sljs/streamlink.js"></script>
</head>
<body>
<script>
var streamlink = caplin.streamlink.StreamLinkFactory.create({
liberator_urls: "<liberator url>",
keymaster_url:"<app server url>/keymaster/servlet/StandardKeyMaster",
keymaster_poll_url:"<app server url>/keymaster/servlet/Poll",
keymaster_cross_domain_authentication: true
});
streamlink.getLogger().addListener({
onLog: function(logInfo) {
log(logInfo);
}
}, caplin.streamlink.LogLevel.FINEST);
function log(message) {
var pre = document.createElement("pre");
var txt = document.createTextNode(message);
pre.appendChild(txt);
document.body.appendChild(pre);
}
streamlink.connect();
</script>
</body>
</html>
Replace the <liberator url>
placeholder with your liberator URL (e.g., http://liberator:8080).
Replace the <app server url>
placeholder with your application server URL (e.g., http://tomcat:8080).
Configure your application server to require authentication for this page (so that you must log in to access the page).
Open this page in your browser to connect to the configured Liberator, using a KeyMaster token obtained from the application server keymaster servlet.
The StreamLink log is printed to the browser window so you can see the detailed log messages to help diagnose problems if StreamLink cannot connect.
Test errors
If the Liberator does not recognise the user, or the user credentials token is not valid, then the status line on the test page goes red and the page displays an error message. The Liberator login may also fail if the Liberator already has the maximum number of concurrent logins for the user. In this case the error message displayed is USER+LICENCE+EXCEEDED
.
Determine the cause of an error
The page that reports errors lists the possible errors that it can detect, and suggests reasons for each error and how to investigate it further (see the example error pages above). If an error is reported, check
the Liberator’s event log file (var/event-rttpd.log
) to see if there are problems with the user trying to log in. See the Liberator Log File Messages.