TIcket #298: FIx regression in default authentication.

This commit is contained in:
Michael Jumper
2013-03-25 03:41:49 -07:00
parent 88bc61b87e
commit 2ee86e392d
3 changed files with 41 additions and 24 deletions

View File

@@ -19,6 +19,7 @@ package net.sourceforge.guacamole.net.basic.xml.user_mapping;
*/
import net.sourceforge.guacamole.net.basic.auth.Authorization;
import net.sourceforge.guacamole.net.basic.auth.UserMapping;
import net.sourceforge.guacamole.net.basic.xml.TagHandler;
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
import org.xml.sax.Attributes;
@@ -44,6 +45,22 @@ public class AuthorizeTagHandler implements TagHandler {
*/
private GuacamoleConfiguration default_config = null;
/**
* The UserMapping this authorization belongs to.
*/
private UserMapping parent;
/**
* Creates a new AuthorizeTagHandler that parses an Authorization owned
* by the given UserMapping.
*
* @param parent The UserMapping that owns the Authorization this handler
* will parse.
*/
public AuthorizeTagHandler(UserMapping parent) {
this.parent = parent;
}
@Override
public void init(Attributes attributes) throws SAXException {
@@ -70,23 +87,16 @@ public class AuthorizeTagHandler implements TagHandler {
}
parent.addAuthorization(this.asAuthorization());
}
@Override
public TagHandler childElement(String localName) throws SAXException {
// "connection" tag
if (localName.equals("connection")) {
// Get tag handler for connection tag
ConnectionTagHandler tagHandler = new ConnectionTagHandler();
// Store configuration stub
GuacamoleConfiguration config_stub = tagHandler.asGuacamoleConfiguration();
authorization.addConfiguration(tagHandler.getName(), config_stub);
return tagHandler;
}
if (localName.equals("connection"))
return new ConnectionTagHandler(authorization);
// "param" tag
if (localName.equals("param")) {

View File

@@ -18,6 +18,7 @@ package net.sourceforge.guacamole.net.basic.xml.user_mapping;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import net.sourceforge.guacamole.net.basic.auth.Authorization;
import net.sourceforge.guacamole.net.basic.xml.TagHandler;
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
import org.xml.sax.Attributes;
@@ -40,9 +41,26 @@ public class ConnectionTagHandler implements TagHandler {
*/
private String name;
/**
* The Authorization this connection belongs to.
*/
private Authorization parent;
/**
* Creates a new ConnectionTagHandler that parses a Connection owned by
* the given Authorization.
*
* @param parent The Authorization that will own this Connection once
* parsed.
*/
public ConnectionTagHandler(Authorization parent) {
this.parent = parent;
}
@Override
public void init(Attributes attributes) throws SAXException {
name = attributes.getValue("name");
parent.addConfiguration(name, this.asGuacamoleConfiguration());
}
@Override

View File

@@ -18,7 +18,6 @@ package net.sourceforge.guacamole.net.basic.xml.user_mapping;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import net.sourceforge.guacamole.net.basic.auth.Authorization;
import net.sourceforge.guacamole.net.basic.auth.UserMapping;
import net.sourceforge.guacamole.net.basic.xml.TagHandler;
import org.xml.sax.Attributes;
@@ -45,18 +44,8 @@ public class UserMappingTagHandler implements TagHandler {
public TagHandler childElement(String localName) throws SAXException {
// Start parsing of authorize tags, add to list of all authorizations
if (localName.equals("authorize")) {
// Get tag handler for authorize tag
AuthorizeTagHandler tagHandler = new AuthorizeTagHandler();
// Store authorization stub in map of authorizations
Authorization auth_stub = tagHandler.asAuthorization();
user_mapping.addAuthorization(auth_stub);
return tagHandler;
}
if (localName.equals("authorize"))
return new AuthorizeTagHandler(user_mapping);
return null;