diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Attributes.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Attributes.java new file mode 100644 index 000000000..050017dd7 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Attributes.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.net.auth; + +import java.util.Map; + +/** + * An object which is associated with a set of arbitrary attributes, defined + * as name/value pairs. + */ +public interface Attributes { + + /** + * Returns all attributes associated with this object. The returned map + * may not be modifiable. + * + * @return + * A map of all attribute identifiers to their corresponding values, + * for all attributes associated with this object, which may not be + * modifiable. + */ + Map getAttributes(); + + /** + * Sets the given attributes. If an attribute within the map is not + * supported, it will simply be dropped. Any attributes not within the given + * map will be left untouched. Attributes which are not declared within the + * associated UserContext MUST NOT be submitted, but other extensions may + * manipulate the declared attributes through decorate() and redecorate(). + * + * Implementations may optionally allow storage of unsupported attributes. + * Extensions which rely on other extensions to store their attribute + * values should verify that such storage is supported by first testing + * that the attribute value is retrievable via getAttributes() after being + * set. + * + * @param attributes + * A map of all attribute identifiers to their corresponding values. + */ + void setAttributes(Map attributes); + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java index 313d89e20..5b1d13d54 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java @@ -21,7 +21,6 @@ package org.apache.guacamole.net.auth; import java.util.Date; import java.util.List; -import java.util.Map; import java.util.Set; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.protocol.GuacamoleConfiguration; @@ -32,7 +31,7 @@ import org.apache.guacamole.protocol.GuacamoleConfiguration; * backing GuacamoleConfiguration may be intentionally obfuscated or tokenized * to protect sensitive configuration information. */ -public interface Connection extends Identifiable, Connectable { +public interface Connection extends Identifiable, Connectable, Attributes { /** * Returns the name assigned to this Connection. @@ -82,36 +81,6 @@ public interface Connection extends Identifiable, Connectable { */ public void setConfiguration(GuacamoleConfiguration config); - /** - * Returns all attributes associated with this connection. The returned map - * may not be modifiable. - * - * @return - * A map of all attribute identifiers to their corresponding values, - * for all attributes associated with this connection, which may not be - * modifiable. - */ - Map getAttributes(); - - /** - * Sets the given attributes. If an attribute within the map is not - * supported, it will simply be dropped. Any attributes not within the given - * map will be left untouched. Attributes which are not declared within - * getConnectionAttributes() of the associated UserContext MUST NOT be - * submitted, but other extensions may manipulate the declared attributes - * through decorate() and redecorate(). - * - * Implementations may optionally allow storage of unsupported attributes. - * Extensions which rely on other extensions to store their attribute - * values should verify that such storage is supported by first testing - * that the attribute value is retrievable via getAttributes() after being - * set. - * - * @param attributes - * A map of all attribute identifiers to their corresponding values. - */ - void setAttributes(Map attributes); - /** * Returns the date and time that this connection was last used. If the * connection was never used, the time that the connection was last used is diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java index 04b494a90..74412de7d 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java @@ -19,7 +19,6 @@ package org.apache.guacamole.net.auth; -import java.util.Map; import java.util.Set; import org.apache.guacamole.GuacamoleException; @@ -27,7 +26,7 @@ import org.apache.guacamole.GuacamoleException; * Represents a connection group, which can contain both other connection groups * as well as connections. */ -public interface ConnectionGroup extends Identifiable, Connectable { +public interface ConnectionGroup extends Identifiable, Connectable, Attributes { /** * All legal types of connection group. @@ -124,34 +123,4 @@ public interface ConnectionGroup extends Identifiable, Connectable { public Set getConnectionGroupIdentifiers() throws GuacamoleException; - /** - * Returns all attributes associated with this connection group. The - * returned map may not be modifiable. - * - * @return - * A map of all attribute identifiers to their corresponding values, - * for all attributes associated with this connection group, which may - * not be modifiable. - */ - Map getAttributes(); - - /** - * Sets the given attributes. If an attribute within the map is not - * supported, it will simply be dropped. Any attributes not within the given - * map will be left untouched. Attributes which are not declared within - * getConnectionGroupAttributes() of the associated UserContext MUST NOT be - * submitted, but other extensions may manipulate the declared attributes - * through decorate() and redecorate(). - * - * Implementations may optionally allow storage of unsupported attributes. - * Extensions which rely on other extensions to store their attribute - * values should verify that such storage is supported by first testing - * that the attribute value is retrievable via getAttributes() after being - * set. - * - * @param attributes - * A map of all attribute identifiers to their corresponding values. - */ - void setAttributes(Map attributes); - } diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java index 3b4ec6570..2d4c4326a 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java @@ -25,7 +25,7 @@ import java.util.Map; * Represents the semantics which apply to an existing connection when shared, * along with a human-readable name and unique identifier. */ -public interface SharingProfile extends Identifiable { +public interface SharingProfile extends Identifiable, Attributes { /** * Returns the human-readable name assigned to this SharingProfile. @@ -93,34 +93,4 @@ public interface SharingProfile extends Identifiable { */ public void setParameters(Map parameters); - /** - * Returns all attributes associated with this sharing profile. The returned - * map may not be modifiable. - * - * @return - * A map of all attribute identifiers to their corresponding values, - * for all attributes associated with this sharing profile, which may - * not be modifiable. - */ - Map getAttributes(); - - /** - * Sets the given attributes. If an attribute within the map is not - * supported, it will simply be dropped. Any attributes not within the - * given map will be left untouched. Attributes which are not declared - * within getSharingProfileAttributes() of the associated UserContext MUST - * NOT be submitted, but other extensions may manipulate the declared - * attributes through decorate() and redecorate(). - * - * Implementations may optionally allow storage of unsupported attributes. - * Extensions which rely on other extensions to store their attribute - * values should verify that such storage is supported by first testing - * that the attribute value is retrievable via getAttributes() after being - * set. - * - * @param attributes - * A map of all attribute identifiers to their corresponding values. - */ - void setAttributes(Map attributes); - } diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java index 49e1f9923..a39a772f0 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java @@ -21,7 +21,6 @@ package org.apache.guacamole.net.auth; import java.util.Date; import java.util.List; -import java.util.Map; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.net.auth.permission.ObjectPermissionSet; import org.apache.guacamole.net.auth.permission.SystemPermissionSet; @@ -30,7 +29,7 @@ import org.apache.guacamole.net.auth.permission.SystemPermissionSet; /** * A user of the Guacamole web application. */ -public interface User extends Identifiable { +public interface User extends Identifiable, Attributes { /** * All standard attribute names with semantics defined by the Guacamole web @@ -81,36 +80,6 @@ public interface User extends Identifiable { */ public void setPassword(String password); - /** - * Returns all attributes associated with this user. The returned map may - * not be modifiable. - * - * @return - * A map of all attribute identifiers to their corresponding values, - * for all attributes associated with this user, which may not be - * modifiable. - */ - Map getAttributes(); - - /** - * Sets the given attributes. If an attribute within the map is not - * supported, it will simply be dropped. Any attributes not within the given - * map will be left untouched. Attributes which are not declared within - * getUserAttributes() of the associated UserContext MUST NOT be submitted, - * but other extensions may manipulate the declared attributes through - * decorate() and redecorate(). - * - * Implementations may optionally allow storage of unsupported attributes. - * Extensions which rely on other extensions to store their attribute - * values should verify that such storage is supported by first testing - * that the attribute value is retrievable via getAttributes() after being - * set. - * - * @param attributes - * A map of all attribute identifiers to their corresponding values. - */ - void setAttributes(Map attributes); - /** * Returns the date and time that this user was last active. If the user * was never active, the time that the user was last active is unknown, or