diff --git a/guacamole/pom.xml b/guacamole/pom.xml
index 5b465e3dc..17f2cc0fd 100644
--- a/guacamole/pom.xml
+++ b/guacamole/pom.xml
@@ -5,7 +5,7 @@
net.sourceforge.guacamole
guacamole-default-webapp
war
- 0.4.0
+ 0.5.0
guacamole-default-webapp
http://guacamole.sourceforge.net/
diff --git a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java
index e2d447f4e..d23f631cf 100644
--- a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java
+++ b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java
@@ -18,8 +18,10 @@ package net.sourceforge.guacamole.net.basic;
* along with this program. If not, see .
*/
+import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.InetGuacamoleSocket;
@@ -59,26 +61,26 @@ public class BasicGuacamoleTunnelServlet extends GuacamoleTunnelServlet {
HttpSession httpSession = request.getSession(true);
- // Retrieve username and password from parms
- String username = request.getParameter("username");
- String password = request.getParameter("password");
+ // Get ID of connection
+ String id = request.getParameter("id");
+
+ // Get authorized configs
+ Map configs =
+ (Map)
+ httpSession.getAttribute("GUAC_AUTH_CONFIGS");
+
+ // If no configs in session, not authorized
+ if (configs == null)
+ throw new GuacamoleException("No authorized configurations.");
// Get authorized config
- GuacamoleConfiguration config;
- try {
- config = authProvider.getAuthorizedConfiguration(username, password);
- }
- catch (GuacamoleException e) {
- logger.error("Error retrieving authorized configuration for user {}.", username);
- throw e;
+ GuacamoleConfiguration config = configs.get(id);
+ if (config == null) {
+ logger.error("Error retrieving authorized configuration id={}.", id);
+ throw new GuacamoleException("Unknown configuration ID.");
}
- if (config == null) {
- logger.warn("Failed login from {} for user \"{}\".", request.getRemoteAddr(), username);
- throw new GuacamoleException("Invalid login");
- }
-
- logger.info("Successful login from {} for user \"{}\".", request.getRemoteAddr(), username);
+ logger.info("Successful connection from {} to \"{}\".", request.getRemoteAddr(), id);
// Configure and connect socket
String hostname = GuacamoleProperties.getProperty(GuacamoleProperties.GUACD_HOSTNAME);
diff --git a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicLogin.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicLogin.java
index 1702421f5..0884f4698 100644
--- a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicLogin.java
+++ b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicLogin.java
@@ -19,6 +19,8 @@ package net.sourceforge.guacamole.net.basic;
*/
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -80,7 +82,11 @@ public class BasicLogin extends HttpServlet {
logger.info("Successful login from {} for user \"{}\".", request.getRemoteAddr(), username);
- httpSession.setAttribute("GUAC_AUTH_CONFIGS", new Integer(0));
+ // Build map of authorized configs
+ Map configs = new HashMap();
+ configs.put("TEST-UID", config);
+
+ httpSession.setAttribute("GUAC_AUTH_CONFIGS", configs);
}
diff --git a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/ConfigurationList.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/ConfigurationList.java
new file mode 100644
index 000000000..b3dae6e60
--- /dev/null
+++ b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/ConfigurationList.java
@@ -0,0 +1,77 @@
+package net.sourceforge.guacamole.net.basic;
+
+/*
+ * Guacamole - Clientless Remote Desktop
+ * Copyright (C) 2010 Michael Jumper
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+import java.util.Map.Entry;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ConfigurationList extends HttpServlet {
+
+ private Logger logger = LoggerFactory.getLogger(ConfigurationList.class);
+
+ @Override
+ protected void service(HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
+
+ HttpSession httpSession = request.getSession(true);
+
+ // Get authorized configs
+ Map configs =
+ (Map)
+ httpSession.getAttribute("GUAC_AUTH_CONFIGS");
+
+ // If no configs in session, not authorized
+ if (configs == null) {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+
+ // Write XML
+ response.setHeader("Content-Type", "text/xml");
+ PrintWriter out = response.getWriter();
+ out.println("");
+
+ for (Entry entry : configs.entrySet()) {
+
+ GuacamoleConfiguration config = entry.getValue();
+
+ // Write config
+ out.print("");
+
+
+ }
+
+ out.println("");
+ }
+
+}
+
diff --git a/guacamole/src/main/webapp/WEB-INF/web.xml b/guacamole/src/main/webapp/WEB-INF/web.xml
index 398328793..2b64e11e2 100644
--- a/guacamole/src/main/webapp/WEB-INF/web.xml
+++ b/guacamole/src/main/webapp/WEB-INF/web.xml
@@ -39,6 +39,17 @@
/login
+
+
+ Configuration list servlet.
+ Configs
+ net.sourceforge.guacamole.net.basic.ConfigurationList
+
+
+ Configs
+ /configs
+
+
Tunnel servlet.
diff --git a/guacamole/src/main/webapp/client.xhtml b/guacamole/src/main/webapp/client.xhtml
index 97bdb6410..58529bd9b 100644
--- a/guacamole/src/main/webapp/client.xhtml
+++ b/guacamole/src/main/webapp/client.xhtml
@@ -91,16 +91,6 @@
new Guacamole.HTTPTunnel("tunnel")
);
- try {
-
- // Connect client
- guac.connect(data);
-
- }
- catch (e) {
- // TODO: Handle exception ...
- }
-
var menu = document.getElementById("menu");
var logo = document.getElementById("status-logo");
@@ -325,6 +315,23 @@
guac.sendKeyEvent(0, KEYSYM_CTRL);
}
+
+ try {
+
+ // Get ID
+ var url = window.location.href;
+ var query = url.indexOf("?");
+ var id = url.substring(query+1);
+
+ // Connect client
+ guac.connect("id=" + encodeURIComponent(id));
+
+ }
+ catch (e) {
+ // TODO: Handle exception ...
+ }
+
+
/* ]]> */