Simple JSS Authentication Extension

Use simple authentication when the password, password-hash or public key are known by the authenticator.

The only method that needs to be implemented is:

loadUserInfo(userName, userInfo)

When the server calls this method in your authenticator, it supplies user information that enables your extension to look up that user's authentication details from an external source. This function returns authentication information for the user with the given user-name.

The first argument is simply a string containing the supplied user-name.

The second argument, userInfo, has the following fields:

The function may either return the password-hash or an object containing any of the following fields:

If the user cannot be authenticated then null should be returned.


Example 1

This example illustrates an authenticator which shows sample source code of using a global associative array (a.k.a. object) to store user account data.

var users = {
	fred: { password: "password" },
	mark: { password: "password", homeDirectory: "C:\\Temp" }

function loadUserInfo(userName) {
	console.log("Authenticating " + userName);
	return users[userName];

Example 2

This example illustrates an authenticator which authenticates by reads user accounts from a JSON file.

var users = system.getFile("/Admin/Extensions/users.json").readObject();

function loadUserInfo(userName) {
	return users[userName];

Example 3

This example illustrates an authenticator which authenticates from a SQL Server Compact database. The database has a single table, Users, with two columns, userName and password.

// open the database - will create if doesn't exist
var db = system.openDatabaseSync("/Admin/Extensions/Authenticators/users.sdf");

// authentication function
function loadUserInfo(userName) {
	var userInfo = null;
	db.readTransaction(function(transaction) {
		var res = transaction.executeSql("SELECT * FROM Users WHERE userName=?", [userName]);
		if (res.rows.length>0) {
			var row  = res.rows[0];
			userInfo = { password: row.password };
	return userInfo;

Example 4

This example illustrates an authenticator which authenticates by fetching the user account data via HTTP (JSS supports HTTP GETs).

var usersFile = http.get("http://localhost/users.json").body;
var users     = JSON.parse(usersFile);

function loadUserInfo(userName) {
	return users[userName];