You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
950 B
31 lines
950 B
module.exports = function(app, io, authentication) { |
|
|
|
var docker = require('docker.js')(app, io); |
|
|
|
// New Authenticated Client |
|
function connection(socket, userdata) { |
|
console.log("=> new connection from "+userdata.username); |
|
docker.connect(socket); |
|
} |
|
|
|
// Handle Connection Authentication |
|
require('socketio-auth')(io, { |
|
authenticate: function (socket, data, callback) { |
|
console.log("=> authenticate: ", data.username); |
|
authentication(data.username, data.password, |
|
function() { |
|
console.log("####LOGIN-SUCESS####"); |
|
callback(null, true) |
|
}, |
|
function() { |
|
console.log("####LOGIN-FAIL####"); |
|
callback(new Error("wrong credentials")) |
|
}); |
|
}, |
|
postAuthenticate: connection, |
|
timeout: "none" |
|
}); |
|
|
|
var module = {}; |
|
return module; |
|
}
|
|
|