You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/10/03 13:45:43 UTC

[1/2] guacamole-client git commit: GUACAMOLE-524: Accept only supported attributes via setAttributes(). Do not replace existing attributes.

Repository: guacamole-client
Updated Branches:
  refs/heads/master 220d9b299 -> 863670a58


GUACAMOLE-524: Accept only supported attributes via setAttributes(). Do not replace existing attributes.

Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/aae17f3a
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/aae17f3a
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/aae17f3a

Branch: refs/heads/master
Commit: aae17f3a9f0245f08b5bc1f7ac13d4ad2aa49728
Parents: 220d9b2
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Oct 1 12:10:37 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Tue Oct 2 20:32:24 2018 -0700

----------------------------------------------------------------------
 .../auth/jdbc/user/RemoteAuthenticatedUser.java      | 10 ++--------
 .../auth/ldap/AuthenticationProviderService.java     |  5 +----
 .../guacamole/auth/ldap/user/AuthenticatedUser.java  | 15 ++++++++++-----
 3 files changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/aae17f3a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/RemoteAuthenticatedUser.java
----------------------------------------------------------------------
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 d672719..f994655 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,7 +19,6 @@
 
 package org.apache.guacamole.auth.jdbc.user;
 
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Collections;
 import java.util.Set;
@@ -48,11 +47,6 @@ public abstract class RemoteAuthenticatedUser implements AuthenticatedUser {
     private final String remoteHost;
 
     /**
-     * Arbitrary attributes associated with this RemoteAuthenticatedUser object.
-     */
-    private Map<String, String> attributes = new HashMap<String, String>();
-
-    /**
      * The identifiers of any groups of which this user is a member, including
      * groups inherited through membership in other groups.
      */
@@ -60,12 +54,12 @@ public abstract class RemoteAuthenticatedUser implements AuthenticatedUser {
 
     @Override
     public Map<String, String> getAttributes() {
-        return attributes;
+        return Collections.<String, String>emptyMap();
     }
 
     @Override
     public void setAttributes(Map<String, String> attributes) {
-        this.attributes = attributes;
+        // No attributes supported
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/aae17f3a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/AuthenticationProviderService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/AuthenticationProviderService.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/AuthenticationProviderService.java
index e359221..b7e9830 100644
--- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/AuthenticationProviderService.java
+++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/AuthenticationProviderService.java
@@ -232,10 +232,7 @@ public class AuthenticationProviderService {
         try {
             // Return AuthenticatedUser if bind succeeds
             AuthenticatedUser authenticatedUser = authenticatedUserProvider.get();
-            authenticatedUser.init(credentials);
-
-            // Set attributes
-            authenticatedUser.setAttributes(getLDAPAttributes(ldapConnection, credentials.getUsername()));
+            authenticatedUser.init(credentials, getLDAPAttributes(ldapConnection, credentials.getUsername()));
 
             return authenticatedUser;
 

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/aae17f3a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/AuthenticatedUser.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/AuthenticatedUser.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/AuthenticatedUser.java
index 8e99267..aadb687 100644
--- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/AuthenticatedUser.java
+++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/AuthenticatedUser.java
@@ -20,7 +20,6 @@
 package org.apache.guacamole.auth.ldap.user;
 
 import com.google.inject.Inject;
-import java.util.HashMap;
 import java.util.Map;
 import org.apache.guacamole.net.auth.AbstractAuthenticatedUser;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
@@ -47,16 +46,22 @@ public class AuthenticatedUser extends AbstractAuthenticatedUser {
     /**
      * Arbitrary attributes associated with this AuthenticatedUser object.
      */
-    private Map<String, String> attributes = new HashMap<String, String>();
+    private Map<String, String> attributes;
 
     /**
-     * Initializes this AuthenticatedUser using the given credentials.
+     * Initializes this AuthenticatedUser using the given credentials and
+     * arbitrary attributes.
      *
      * @param credentials
      *     The credentials provided when this user was authenticated.
+     *
+     * @param attributes
+     *     The map of arbitrary attribute name/value pairs to associate with
+     *     this AuthenticatedUser.
      */
-    public void init(Credentials credentials) {
+    public void init(Credentials credentials, Map<String, String> attributes) {
         this.credentials = credentials;
+        this.attributes = attributes;
         setIdentifier(credentials.getUsername());
     }
 
@@ -67,7 +72,7 @@ public class AuthenticatedUser extends AbstractAuthenticatedUser {
 
     @Override
     public void setAttributes(Map<String, String> attributes) {
-        this.attributes = attributes;
+        // All attributes are read-only
     }
 
     @Override


[2/2] guacamole-client git commit: GUACAMOLE-524: Merge correct AuthenticatedUser implementations of Attributes interface.

Posted by vn...@apache.org.
GUACAMOLE-524: Merge correct AuthenticatedUser implementations of Attributes interface.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/863670a5
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/863670a5
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/863670a5

Branch: refs/heads/master
Commit: 863670a58086527f16bd3e380f5436dfe60f416e
Parents: 220d9b2 aae17f3
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Oct 3 09:44:52 2018 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Wed Oct 3 09:44:52 2018 -0400

----------------------------------------------------------------------
 .../auth/jdbc/user/RemoteAuthenticatedUser.java      | 10 ++--------
 .../auth/ldap/AuthenticationProviderService.java     |  5 +----
 .../guacamole/auth/ldap/user/AuthenticatedUser.java  | 15 ++++++++++-----
 3 files changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------