From 862ab91432ed8638ecea0fd187d95eafa49c58fe Mon Sep 17 00:00:00 2001 From: Jared Frees Date: Tue, 12 Jun 2018 11:33:14 -0400 Subject: [PATCH] GUACAMOLE-524: Implemented getAttributes and setAttributes to satisfy Attributes interface addition --- .../jdbc/user/RemoteAuthenticatedUser.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/RemoteAuthenticatedUser.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/RemoteAuthenticatedUser.java index 24118af45..3b16a992b 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/RemoteAuthenticatedUser.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/RemoteAuthenticatedUser.java @@ -19,6 +19,8 @@ package org.apache.guacamole.auth.jdbc.user; +import java.util.HashMap; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.http.HttpServletRequest; @@ -67,6 +69,21 @@ public abstract class RemoteAuthenticatedUser implements AuthenticatedUser { */ private static final Pattern X_FORWARDED_FOR = Pattern.compile("^" + IP_ADDRESS_REGEX + "(, " + IP_ADDRESS_REGEX + ")*$"); + /** + * Arbitrary attributes associated with this RemoteAuthenticatedUser object. + */ + private Map attributes = new HashMap(); + + @Override + public Map getAttributes() { + return attributes; + } + + @Override + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + /** * Derives the remote host of the authenticating user from the given * credentials object. The remote host is derived from X-Forwarded-For @@ -98,7 +115,7 @@ public abstract class RemoteAuthenticatedUser implements AuthenticatedUser { return request.getRemoteAddr(); } - + /** * Creates a new RemoteAuthenticatedUser, deriving the associated remote * host from the given credentials. @@ -106,7 +123,7 @@ public abstract class RemoteAuthenticatedUser implements AuthenticatedUser { * @param authenticationProvider * The AuthenticationProvider that has authenticated the given user. * - * @param credentials + * @param credentials * The credentials given by the user when they authenticated. */ public RemoteAuthenticatedUser(AuthenticationProvider authenticationProvider,