not a promise.
Im trying to extract password, and role from a database, followin this example
https://github.com/crossbario/crossbarexamples/tree/master/authenticate/wampcradynamic/nodejs
function authenticate (args)
{
var realm = args[0];
var authid = args[1];
var details = args[2];
var d = autobahn.when.defer();
models.Users.findOne({
where: {username: authid}
}).then(function (user) {
if (user !== null) {
user.getAuthItems().then(function (items)
{
var role = null;
for (i in items) {
role = items[i].name;
}
if (role !== null) {
auth = {
'secret': user.password,
'role': role
}
d.resolve(auth);
} else {
d.reject("no such role");
throw "not role assigned";
}
});
} else {
d.reject("no such user");
throw "no such user";
}
});
return d.promise;
}