|
diff --git a/config.js b/config.js |
|
index 5f4fc26..2564fe7 100644 |
|
--- a/config.js |
|
+++ b/config.js |
|
@@ -3,4 +3,9 @@ |
|
exports.Config = { |
|
ip: "127.0.0.1", |
|
port: 3000, |
|
gaeLocalPath: ".", |
|
-}; |
|
+ // add for secure |
|
+ secure: { |
|
+ user: "username", |
|
+ password: "password" |
|
+ } |
|
+}; |
|
|
|
diff --git a/bin/cloud9.js b/bin/cloud9.js |
|
index a3b15c9..2debbed 100755 |
|
--- a/bin/cloud9.js |
|
+++ b/bin/cloud9.js |
|
@@ -28,6 +28,12 @@ |
|
var options = Parser.parse([ |
|
var pref = ( value.charAt(0) == "/" ) ? "" : process.cwd() + "/"; |
|
return require(pref + value.replace(".js", "")).Config; |
|
} |
|
+ }, |
|
+ // add for secure |
|
+ {short: "s", long: "secure", description: "Secure Cloud9 with user:password for HTTP basic acc |
|
+ var posDelimeter = value.indexOf(':'); |
|
+ return {user: value.substr(0, posDelimeter), password: value.substr(posDelimeter + 1)} |
|
+ } |
|
} |
|
], true); |
|
|
|
diff --git a/server/cloud9/index.js b/server/cloud9/index.js |
|
index 34c744a..0cef23e 100644 |
|
--- a/server/cloud9/index.js |
|
+++ b/server/cloud9/index.js |
|
@@ -5,6 +5,7 @@ |
|
require("../../support/paths"); |
|
|
|
var Connect = require("connect"); |
|
+var ConnectAuth = require('basicAuth'); // add for secure |
|
var IO = require("socket.io"); |
|
var Fs = require("fs"); |
|
var Path = require("path"); |
|
@@ -17,7 +18,8 @@ |
|
exports.main = function(options) { |
|
port = options.port, |
|
ip = options.ip, |
|
user = options.user, |
|
- group = options.group; |
|
+ group = options.group, |
|
+ secure = options.secure; // add for secure |
|
|
|
if (!Path.existsSync(projectDir)) |
|
throw new Error("Workspace directory does not exist: " + projectDir); |
|
@@ -64,6 +66,12 @@ |
|
exports.main = function(options) { |
|
}; |
|
|
|
var server = Connect.createServer(); |
|
+ // add for secure |
|
+ if (secure) { |
|
+ server.use(ConnectAuth(function (user, password) { |
|
+ return user === secure.user && password == secure.password; |
|
+ })); |
|
+ } |
|
//server.use(Connect.logger()); |
|
server.use(Connect.conditionalGet()); |
|
server.use(Connect.cookieDecoder()); |
hello,
I have trouble on implementing this. Do you have a simplified explanation on how to implement this?