diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java index a150212c8..d1c4545cb 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java @@ -401,14 +401,7 @@ public class ActiveConnectionRecord implements ConnectionRecord { } - /** - * Returns the UUID of the underlying tunnel. If there is no underlying - * tunnel, this will be the UUID assigned to the underlying tunnel when the - * tunnel is set. - * - * @return - * The current or future UUID of the underlying tunnel. - */ + @Override public UUID getUUID() { return uuid; } diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecord.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecord.java index 2324b0ee4..13d4bf3a2 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecord.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecord.java @@ -19,13 +19,16 @@ package org.apache.guacamole.net.auth; +import java.util.Collections; import java.util.Date; +import java.util.Map; +import java.util.UUID; /** * A logging record describing when a user started and ended a particular * activity. */ -public interface ActivityRecord { +public interface ActivityRecord extends ReadableAttributes { /** * Returns the date and time the activity began. @@ -75,4 +78,23 @@ public interface ActivityRecord { */ public boolean isActive(); + /** + * Returns a UUID that uniquely identifies this record. If provided, this + * UUID MUST be deterministic and unique across all {@link ActivityRecord} + * objects within the same {@link ActivityRecordSet}, and SHOULD be unique + * across all {@link ActivityRecord} objects. + * + * @return + * A UUID that uniquely identifies this record, or null if no such + * unique identifier exists. + */ + public default UUID getUUID() { + return null; + } + + @Override + public default Map getAttributes() { + return Collections.emptyMap(); + } + } diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java index 21e30a98e..ecb378e51 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java @@ -19,6 +19,8 @@ package org.apache.guacamole.net.auth; +import java.util.UUID; + /** * A logging record describing when a user started and ended usage of a * particular connection. @@ -70,4 +72,15 @@ public interface ConnectionRecord extends ActivityRecord { */ public String getSharingProfileName(); + /** + * {@inheritDoc} + *

If implemented, this UUID SHOULD be identical to the UUID of the + * {@link GuacamoleTunnel} originally returned when the connection was + * established to allow extensions and/or the web application to + * automatically associate connection information with corresponding + * history records, such as log messages and session recordings. + */ + @Override + public UUID getUUID(); + } diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/history/APIActivityRecord.java b/guacamole/src/main/java/org/apache/guacamole/rest/history/APIActivityRecord.java index c1a0149d6..0eb6f62e0 100644 --- a/guacamole/src/main/java/org/apache/guacamole/rest/history/APIActivityRecord.java +++ b/guacamole/src/main/java/org/apache/guacamole/rest/history/APIActivityRecord.java @@ -20,6 +20,8 @@ package org.apache.guacamole.rest.history; import java.util.Date; +import java.util.Map; +import java.util.UUID; import org.apache.guacamole.net.auth.ActivityRecord; /** @@ -55,6 +57,24 @@ public class APIActivityRecord { */ private final boolean active; + /** + * The unique identifier assigned to this record, or null if this record + * has no such identifier. + */ + private final String identifier; + + /** + * A UUID that uniquely identifies this record, or null if no such unique + * identifier exists. + */ + private final UUID uuid; + + /** + * A map of all attribute identifiers to their corresponding values, for + * all attributes associated with this record. + */ + private final Map attributes; + /** * Creates a new APIActivityRecord, copying the data from the given activity * record. @@ -68,6 +88,8 @@ public class APIActivityRecord { this.remoteHost = record.getRemoteHost(); this.username = record.getUsername(); this.active = record.isActive(); + this.uuid = record.getUUID(); + this.attributes = record.getAttributes(); } /** @@ -128,4 +150,27 @@ public class APIActivityRecord { return active; } + /** + * Returns a UUID that uniquely identifies this record. If not implemented + * by the extension exposing this history record, this may be null. + * + * @return + * A UUID that uniquely identifies this record, or null if no such + * unique identifier exists. + */ + public UUID getUUID() { + return uuid; + } + + /** + * Returns all attributes associated with this record. + * + * @return + * A map of all attribute identifiers to their corresponding values, + * for all attributes associated with this record. + */ + public Map getAttributes() { + return attributes; + } + }