Rename remote-server to connection.
authorMichael Jumper <zhangmaike@users.sourceforge.net>
Wed, 18 Apr 2012 19:08:05 +0000 (12:08 -0700)
committerMichael Jumper <zhangmaike@users.sourceforge.net>
Wed, 18 Apr 2012 19:08:05 +0000 (12:08 -0700)
doc/example/user-mapping.xml
src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java

index 0f3168d..5741dec 100644 (file)
@@ -4,12 +4,12 @@
     <authorize username="USERNAME" password="PASSWORD">
 
         <!-- Single authorized connection -->
-               <remote-server servername="localhost">
+               <connection name="localhost">
             <protocol>vnc</protocol>
             <param name="hostname">localhost</param>
             <param name="port">5900</param>
             <param name="password">VNCPASS</param>
-        </remote-server>
+        </connection>
 
     </authorize>
 
             encoding="md5">
 
         <!-- First authorized connection -->
-               <remote-server servername="localhost">
+               <connection name="localhost">
             <protocol>vnc</protocol>
             <param name="hostname">localhost</param>
             <param name="port">5901</param>
             <param name="password">VNCPASS</param>
-        </remote-server>
+        </connection>
 
         <!-- Second authorized connection -->
-               <remote-server servername="otherhost">
+               <connection name="otherhost">
             <protocol>vnc</protocol>
             <param name="hostname">otherhost</param>
             <param name="port">5900</param>
             <param name="password">VNCPASS</param>
-        </remote-server>
+        </connection>
 
  </authorize>
 
index 06be103..d31e2ba 100644 (file)
@@ -250,7 +250,7 @@ public class BasicFileAuthenticationProvider implements AuthenticationProvider {
         private enum State {
             ROOT,
             USER_MAPPING,
-            REMOTE_SERVER,
+            CONNECTION,
             AUTH_INFO,
             PROTOCOL,
             PARAMETER,
@@ -260,7 +260,7 @@ public class BasicFileAuthenticationProvider implements AuthenticationProvider {
         private State state = State.ROOT;
         private AuthInfo current = null;
         private String currentParameter = null;
-        private String currentRemoteServer = null;
+        private String currentConnection = null;
 
         @Override
         public void endElement(String uri, String localName, String qName) throws SAXException {
@@ -292,9 +292,9 @@ public class BasicFileAuthenticationProvider implements AuthenticationProvider {
 
                 break;
                 
-            case REMOTE_SERVER:
+            case CONNECTION:
 
-                if (localName.equals("remote-server")) {
+                if (localName.equals("connection")) {
                     state = State.AUTH_INFO;
                     return;
                 }
@@ -304,7 +304,7 @@ public class BasicFileAuthenticationProvider implements AuthenticationProvider {
             case PROTOCOL:
 
                 if (localName.equals("protocol")) {
-                    state = State.REMOTE_SERVER;
+                    state = State.CONNECTION;
                     return;
                 }
 
@@ -313,7 +313,7 @@ public class BasicFileAuthenticationProvider implements AuthenticationProvider {
             case PARAMETER:
 
                 if (localName.equals("param")) {
-                    state = State.REMOTE_SERVER;
+                    state = State.CONNECTION;
                     return;
                 }
 
@@ -371,22 +371,22 @@ public class BasicFileAuthenticationProvider implements AuthenticationProvider {
 
                 case AUTH_INFO:
 
-                    if (localName.equals("remote-server")) {
+                    if (localName.equals("connection")) {
 
-                        currentRemoteServer = attributes.getValue("servername");
-                        if (currentRemoteServer == null)
-                            throw new SAXException("Attribute \"servername\" required for param tag.");
+                        currentConnection = attributes.getValue("name");
+                        if (currentConnection == null)
+                            throw new SAXException("Attribute \"name\" required for param tag.");
                         
-                        current.addConfiguration(currentRemoteServer);
+                        current.addConfiguration(currentConnection);
                         
                         // Next state
-                        state = State.REMOTE_SERVER;
+                        state = State.CONNECTION;
                         return;
                     }
 
                     break;
                     
-                case REMOTE_SERVER:
+                case CONNECTION:
 
                     if (localName.equals("protocol")) {
                         // Next state
@@ -421,12 +421,12 @@ public class BasicFileAuthenticationProvider implements AuthenticationProvider {
             switch (state) {
 
                 case PROTOCOL:
-                    current.getConfiguration(currentRemoteServer)
+                    current.getConfiguration(currentConnection)
                         .setProtocol(str);
                     return;
 
                 case PARAMETER:
-                    current.getConfiguration(currentRemoteServer)
+                    current.getConfiguration(currentConnection)
                             .setParameter(currentParameter, str);
                     return;