You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2016/08/14 01:27:04 UTC

[1/8] incubator-guacamole-client git commit: GUACAMOLE-78: Define a standard identifier for anonymous users.

Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master 49d50ee7e -> 8564f05ea


GUACAMOLE-78: Define a standard identifier for anonymous users.

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

Branch: refs/heads/master
Commit: fcefa7a7c7a0454994f0e184b70a2b4d631f12ec
Parents: 8e283ef
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 12 12:51:53 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Aug 12 12:51:53 2016 -0700

----------------------------------------------------------------------
 .../apache/guacamole/net/auth/AuthenticatedUser.java   |  6 ++++++
 .../webapp/app/auth/service/authenticationService.js   | 13 +++++++++++++
 2 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/fcefa7a7/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/AuthenticatedUser.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/AuthenticatedUser.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/AuthenticatedUser.java
index 514e65a..b121abf 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/AuthenticatedUser.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/AuthenticatedUser.java
@@ -29,6 +29,12 @@ package org.apache.guacamole.net.auth;
 public interface AuthenticatedUser extends Identifiable {
 
     /**
+     * The identifier reserved for representing a user that has authenticated
+     * anonymously.
+     */
+    public static final String ANONYMOUS_IDENTIFIER = "";
+
+    /**
      * Returns the AuthenticationProvider that authenticated this user.
      *
      * @return

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/fcefa7a7/guacamole/src/main/webapp/app/auth/service/authenticationService.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/auth/service/authenticationService.js b/guacamole/src/main/webapp/app/auth/service/authenticationService.js
index 2bd6a9f..339a3e1 100644
--- a/guacamole/src/main/webapp/app/auth/service/authenticationService.js
+++ b/guacamole/src/main/webapp/app/auth/service/authenticationService.js
@@ -257,6 +257,19 @@ angular.module('auth').factory('authenticationService', ['$injector',
     };
 
     /**
+     * Returns whether the current user has authenticated anonymously. An
+     * anonymous user is denoted by the identifier reserved by the Guacamole
+     * extension API for anonymous users (the empty string).
+     *
+     * @returns {Boolean}
+     *     true if the current user has authenticated anonymously, false
+     *     otherwise.
+     */
+    service.isAnonymous = function isAnonymous() {
+        return service.getCurrentUsername() === '';
+    };
+
+    /**
      * Returns the username of the current user. If the current user is not
      * logged in, this value may not be valid.
      *


[8/8] incubator-guacamole-client git commit: GUACAMOLE-78: Merge anonymous user display refinements.

Posted by jm...@apache.org.
GUACAMOLE-78: Merge anonymous user display refinements.


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

Branch: refs/heads/master
Commit: 8564f05eadc89aa91bf4c36a446de54140c79ed3
Parents: 49d50ee 21f184f
Author: James Muehlner <ja...@guac-dev.org>
Authored: Sat Aug 13 18:25:44 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Sat Aug 13 18:25:44 2016 -0700

----------------------------------------------------------------------
 .../sharing/user/SharedAuthenticatedUser.java   |   6 +-
 .../guacamole/net/auth/AuthenticatedUser.java   |   6 +
 .../app/auth/service/authenticationService.js   | 110 ++++++++++++++++---
 .../app/auth/types/AuthenticationResult.js      |  81 ++++++++++++++
 .../webapp/app/index/config/indexRouteConfig.js |   2 +-
 .../webapp/app/list/directives/guacUserItem.js  |  92 ++++++++++++++++
 .../src/main/webapp/app/list/listModule.js      |   4 +-
 .../main/webapp/app/list/styles/user-item.css   |  23 ++++
 .../webapp/app/list/templates/guacUserItem.html |   3 +
 .../app/manage/templates/manageConnection.html  |   2 +-
 .../app/navigation/directives/guacUserMenu.js   |  13 ++-
 .../app/navigation/templates/guacUserMenu.html  |   2 +-
 .../templates/settingsConnectionHistory.html    |   2 +-
 .../settings/templates/settingsSessions.html    |   2 +-
 guacamole/src/main/webapp/translations/en.json  |   7 ++
 15 files changed, 330 insertions(+), 25 deletions(-)
----------------------------------------------------------------------



[4/8] incubator-guacamole-client git commit: GUACAMOLE-78: Use documented AuthenticationResult type for auth result storage.

Posted by jm...@apache.org.
GUACAMOLE-78: Use documented AuthenticationResult type for auth result storage.

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

Branch: refs/heads/master
Commit: 22b3e268d6a5f3480af145b05e51677a396c7686
Parents: c632350
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 12 14:18:33 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Aug 12 14:21:58 2016 -0700

----------------------------------------------------------------------
 .../app/auth/service/authenticationService.js   | 74 ++++++++++++++----
 .../app/auth/types/AuthenticationResult.js      | 81 ++++++++++++++++++++
 2 files changed, 140 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/22b3e268/guacamole/src/main/webapp/app/auth/service/authenticationService.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/auth/service/authenticationService.js b/guacamole/src/main/webapp/app/auth/service/authenticationService.js
index 339a3e1..e6fc0d7 100644
--- a/guacamole/src/main/webapp/app/auth/service/authenticationService.js
+++ b/guacamole/src/main/webapp/app/auth/service/authenticationService.js
@@ -42,7 +42,8 @@ angular.module('auth').factory('authenticationService', ['$injector',
         function authenticationService($injector) {
 
     // Required types
-    var Error = $injector.get('Error');
+    var AuthenticationResult = $injector.get('AuthenticationResult');
+    var Error                = $injector.get('Error');
 
     // Required services
     var $cookieStore = $injector.get('$cookieStore');
@@ -53,14 +54,62 @@ angular.module('auth').factory('authenticationService', ['$injector',
     var service = {};
 
     /**
-     * The unique identifier of the local cookie which stores the user's
-     * current authentication token and username.
+     * The unique identifier of the local cookie which stores the result of the
+     * last authentication attempt.
      *
      * @type String
      */
     var AUTH_COOKIE_ID = "GUAC_AUTH";
 
     /**
+     * Retrieves the last successful authentication result. If the user has not
+     * yet authenticated, the user has logged out, or the last authentication
+     * attempt failed, null is returned.
+     *
+     * @returns {AuthenticationResult}
+     *     The last successful authentication result, or null if the user is not
+     *     currently authenticated.
+     */
+    var getAuthenticationResult = function getAuthenticationResult() {
+
+        // Return explicit null if no auth data is currently stored
+        var data = $cookieStore.get(AUTH_COOKIE_ID);
+        if (!data)
+            return null;
+
+        return new AuthenticationResult(data);
+
+    };
+
+    /**
+     * Stores the given authentication result for future retrieval. The given
+     * result MUST be the result of the most recent authentication attempt.
+     *
+     * @param {AuthenticationResult} data
+     *     The last successful authentication result, or null if the last
+     *     authentication attempt failed.
+     */
+    var setAuthenticationResult = function setAuthenticationResult(data) {
+
+        // Clear the currently-stored result if the last attempt failed
+        if (!data)
+            $cookieStore.remove(AUTH_COOKIE_ID);
+
+        // Otherwise store the authentication attempt directly
+        else
+            $cookieStore.put(AUTH_COOKIE_ID, data);
+
+    };
+
+    /**
+     * Clears the stored authentication result, if any. If no authentication
+     * result is currently stored, this function has no effect.
+     */
+    var clearAuthenticationResult = function clearAuthenticationResult() {
+        setAuthenticationResult(null);
+    };
+
+    /**
      * Makes a request to authenticate a user using the token REST API endpoint
      * and given arbitrary parameters, returning a promise that succeeds only
      * if the authentication operation was successful. The resulting
@@ -95,12 +144,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
         var completeAuthentication = function completeAuthentication(data) {
 
             // Store auth data
-            $cookieStore.put(AUTH_COOKIE_ID, {
-                'authToken'            : data.authToken,
-                'username'             : data.username,
-                'dataSource'           : data.dataSource,
-                'availableDataSources' : data.availableDataSources
-            });
+            setAuthenticationResult(new AuthenticationResult(data));
 
             // Process is complete
             authenticationProcess.resolve();
@@ -114,7 +158,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
             headers: {
                 'Content-Type': 'application/x-www-form-urlencoded'
             },
-            data: $.param(parameters),
+            data: $.param(parameters)
         })
 
         // If authentication succeeds, handle received auth data
@@ -243,7 +287,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
         
         // Clear authentication data
         var token = service.getCurrentToken();
-        $cookieStore.remove(AUTH_COOKIE_ID);
+        clearAuthenticationResult();
 
         // Notify listeners that a token is being destroyed
         $rootScope.$broadcast('guacLogout', token);
@@ -280,7 +324,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
     service.getCurrentUsername = function getCurrentUsername() {
 
         // Return username, if available
-        var authData = $cookieStore.get(AUTH_COOKIE_ID);
+        var authData = getAuthenticationResult();
         if (authData)
             return authData.username;
 
@@ -300,7 +344,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
     service.getCurrentToken = function getCurrentToken() {
 
         // Return auth token, if available
-        var authData = $cookieStore.get(AUTH_COOKIE_ID);
+        var authData = getAuthenticationResult();
         if (authData)
             return authData.authToken;
 
@@ -320,7 +364,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
     service.getDataSource = function getDataSource() {
 
         // Return data source, if available
-        var authData = $cookieStore.get(AUTH_COOKIE_ID);
+        var authData = getAuthenticationResult();
         if (authData)
             return authData.dataSource;
 
@@ -340,7 +384,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
     service.getAvailableDataSources = function getAvailableDataSources() {
 
         // Return data sources, if available
-        var authData = $cookieStore.get(AUTH_COOKIE_ID);
+        var authData = getAuthenticationResult();
         if (authData)
             return authData.availableDataSources;
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/22b3e268/guacamole/src/main/webapp/app/auth/types/AuthenticationResult.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/auth/types/AuthenticationResult.js b/guacamole/src/main/webapp/app/auth/types/AuthenticationResult.js
new file mode 100644
index 0000000..e277461
--- /dev/null
+++ b/guacamole/src/main/webapp/app/auth/types/AuthenticationResult.js
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+/**
+ * Service which defines the AuthenticationResult class.
+ */
+angular.module('auth').factory('AuthenticationResult', [function defineAuthenticationResult() {
+            
+    /**
+     * The object returned by REST API calls when representing the successful
+     * result of an authentication attempt.
+     * 
+     * @constructor
+     * @param {AuthenticationResult|Object} [template={}]
+     *     The object whose properties should be copied within the new
+     *     AuthenticationResult.
+     */
+    var AuthenticationResult = function AuthenticationResult(template) {
+
+        // Use empty object by default
+        template = template || {};
+
+        /**
+         * The unique token generated for the user that authenticated.
+         *
+         * @type String
+         */
+        this.authToken = template.authToken;
+
+        /**
+         * The name which uniquely identifies the user that authenticated.
+         *
+         * @type String
+         */
+        this.username = template.username;
+
+        /**
+         * The unique identifier of the data source which authenticated the
+         * user.
+         *
+         * @type String
+         */
+        this.dataSource = template.dataSource;
+
+        /**
+         * The identifiers of all data sources available to the user that
+         * authenticated.
+         *
+         * @type String[]
+         */
+        this.availableDataSources = template.availableDataSources;
+
+    };
+
+    /**
+     * The username reserved by the Guacamole extension API for users which have
+     * authenticated anonymously.
+     *
+     * @type String
+     */
+    AuthenticationResult.ANONYMOUS_USERNAME = '';
+
+    return AuthenticationResult;
+
+}]);


[6/8] incubator-guacamole-client git commit: GUACAMOLE-78: Preserve query parameters when redirecting to user's home page.

Posted by jm...@apache.org.
GUACAMOLE-78: Preserve query parameters when redirecting to user's home page.

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

Branch: refs/heads/master
Commit: 42cd4dca5d0b6a68052744604d32693d6497aa7c
Parents: 225736d
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 12 14:53:54 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Aug 12 14:53:54 2016 -0700

----------------------------------------------------------------------
 guacamole/src/main/webapp/app/index/config/indexRouteConfig.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/42cd4dca/guacamole/src/main/webapp/app/index/config/indexRouteConfig.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/index/config/indexRouteConfig.js b/guacamole/src/main/webapp/app/index/config/indexRouteConfig.js
index 904ab85..dd2ec6d 100644
--- a/guacamole/src/main/webapp/app/index/config/indexRouteConfig.js
+++ b/guacamole/src/main/webapp/app/index/config/indexRouteConfig.js
@@ -88,7 +88,7 @@ angular.module('index').config(['$routeProvider', '$locationProvider',
 
                 // Otherwise, reject and reroute
                 else {
-                    $location.url(homePage.url);
+                    $location.path(homePage.url);
                     route.reject();
                 }
 


[7/8] incubator-guacamole-client git commit: GUACAMOLE-78: Render the usernames of anonymous users differently.

Posted by jm...@apache.org.
GUACAMOLE-78: Render the usernames of anonymous users differently.

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

Branch: refs/heads/master
Commit: 21f184f42e63c5a338354d17fbcd06db7602c310
Parents: 42cd4dc
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 12 20:05:33 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Aug 12 20:05:33 2016 -0700

----------------------------------------------------------------------
 .../webapp/app/list/directives/guacUserItem.js  | 92 ++++++++++++++++++++
 .../src/main/webapp/app/list/listModule.js      |  4 +-
 .../main/webapp/app/list/styles/user-item.css   | 23 +++++
 .../webapp/app/list/templates/guacUserItem.html |  3 +
 .../app/manage/templates/manageConnection.html  |  2 +-
 .../templates/settingsConnectionHistory.html    |  2 +-
 .../settings/templates/settingsSessions.html    |  2 +-
 guacamole/src/main/webapp/translations/en.json  |  7 ++
 8 files changed, 131 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21f184f4/guacamole/src/main/webapp/app/list/directives/guacUserItem.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/list/directives/guacUserItem.js b/guacamole/src/main/webapp/app/list/directives/guacUserItem.js
new file mode 100644
index 0000000..5c5d26d
--- /dev/null
+++ b/guacamole/src/main/webapp/app/list/directives/guacUserItem.js
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+/**
+ * A directive which graphically represents an individual user.
+ */
+angular.module('list').directive('guacUserItem', [function guacUserItem() {
+
+    return {
+        restrict: 'E',
+        replace: true,
+        scope: {
+
+            /**
+             * The username of the user represented by this guacUserItem.
+             *
+             * @type String
+             */
+            username : '='
+
+        },
+
+        templateUrl: 'app/list/templates/guacUserItem.html',
+        controller: ['$scope', '$injector',
+            function guacUserItemController($scope, $injector) {
+
+            // Required types
+            var AuthenticationResult = $injector.get('AuthenticationResult');
+
+            // Required services
+            var $translate = $injector.get('$translate');
+
+            /**
+             * The string to display when listing the user having the provided
+             * username. Generally, this will be the username itself, but can
+             * also be an arbitrary human-readable representation of the user,
+             * or null if the display name is not yet determined.
+             *
+             * @type String
+             */
+            $scope.displayName = null;
+
+            /**
+             * Returns whether the username provided to this directive denotes
+             * a user that authenticated anonymously.
+             *
+             * @returns {Boolean}
+             *     true if the username provided represents an anonymous user,
+             *     false otherwise.
+             */
+            $scope.isAnonymous = function isAnonymous() {
+                return $scope.username === AuthenticationResult.ANONYMOUS_USERNAME;
+            };
+
+            // Update display name whenever provided username changes
+            $scope.$watch('username', function updateDisplayName(username) {
+
+                // If the user is anonymous, pull the display name for anonymous
+                // users from the translation service
+                if ($scope.isAnonymous()) {
+                    $translate('LIST.TEXT_ANONYMOUS_USER')
+                    .then(function retrieveAnonymousDisplayName(anonymousDisplayName) {
+                        $scope.displayName = anonymousDisplayName;
+                    });
+                }
+
+                // For all other users, use the username verbatim
+                else
+                    $scope.displayName = username;
+
+            });
+
+        }] // end controller
+
+    };
+}]);

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21f184f4/guacamole/src/main/webapp/app/list/listModule.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/list/listModule.js b/guacamole/src/main/webapp/app/list/listModule.js
index b3e6581..845c8c9 100644
--- a/guacamole/src/main/webapp/app/list/listModule.js
+++ b/guacamole/src/main/webapp/app/list/listModule.js
@@ -21,4 +21,6 @@
  * Module for displaying, sorting, and filtering the contents of a list, split
  * into multiple pages.
  */
-angular.module('list', []);
+angular.module('list', [
+    'auth'
+]);

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21f184f4/guacamole/src/main/webapp/app/list/styles/user-item.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/list/styles/user-item.css b/guacamole/src/main/webapp/app/list/styles/user-item.css
new file mode 100644
index 0000000..ffedd39
--- /dev/null
+++ b/guacamole/src/main/webapp/app/list/styles/user-item.css
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+.user-item.anonymous {
+    font-style: italic;
+    opacity: 0.5;
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21f184f4/guacamole/src/main/webapp/app/list/templates/guacUserItem.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/list/templates/guacUserItem.html b/guacamole/src/main/webapp/app/list/templates/guacUserItem.html
new file mode 100644
index 0000000..e6ea670
--- /dev/null
+++ b/guacamole/src/main/webapp/app/list/templates/guacUserItem.html
@@ -0,0 +1,3 @@
+<div class="user-item" ng-class="{'anonymous' : isAnonymous() }">
+    <span class="username">{{displayName}}</span>
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21f184f4/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/templates/manageConnection.html b/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
index 336530d..9df51a0 100644
--- a/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
+++ b/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
@@ -75,7 +75,7 @@
             </thead>
             <tbody>
                 <tr ng-repeat="wrapper in wrapperPage">
-                    <td class="username">{{wrapper.entry.username}}</td>
+                    <td class="username"><guac-user-item username="wrapper.entry.username"></guac-user-item></td>
                     <td class="start">{{wrapper.entry.startDate | date:historyDateFormat}}</td>
                     <td class="duration"
                         translate="{{wrapper.durationText}}"

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21f184f4/guacamole/src/main/webapp/app/settings/templates/settingsConnectionHistory.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/settingsConnectionHistory.html b/guacamole/src/main/webapp/app/settings/templates/settingsConnectionHistory.html
index b03ea3e..d0de134 100644
--- a/guacamole/src/main/webapp/app/settings/templates/settingsConnectionHistory.html
+++ b/guacamole/src/main/webapp/app/settings/templates/settingsConnectionHistory.html
@@ -32,7 +32,7 @@
             </thead>
             <tbody ng-class="{loading: !isLoaded()}">
                 <tr ng-repeat="historyEntryWrapper in historyEntryWrapperPage" class="history">
-                    <td>{{historyEntryWrapper.username}}</td>
+                    <td><guac-user-item username="historyEntryWrapper.username"></guac-user-item></td>
                     <td>{{historyEntryWrapper.startDate | date : dateFormat}}</td>
                     <td translate="{{historyEntryWrapper.readableDurationText}}"
                         translate-values="{VALUE: historyEntryWrapper.readableDuration.value, UNIT: historyEntryWrapper.readableDuration.unit}"></td>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21f184f4/guacamole/src/main/webapp/app/settings/templates/settingsSessions.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/settingsSessions.html b/guacamole/src/main/webapp/app/settings/templates/settingsSessions.html
index 917c7db..184ff0b 100644
--- a/guacamole/src/main/webapp/app/settings/templates/settingsSessions.html
+++ b/guacamole/src/main/webapp/app/settings/templates/settingsSessions.html
@@ -37,7 +37,7 @@
                 <td class="select-session">
                     <input ng-change="wrapperSelectionChange(wrapper)" type="checkbox" ng-model="wrapper.checked" />
                 </td>
-                <td>{{wrapper.activeConnection.username}}</td>
+                <td><guac-user-item username="wrapper.activeConnection.username"></guac-user-item></td>
                 <td>{{wrapper.startDate}}</td>
                 <td>{{wrapper.activeConnection.remoteHost}}</td>
                 <td>{{wrapper.name}}</td>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21f184f4/guacamole/src/main/webapp/translations/en.json
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/translations/en.json b/guacamole/src/main/webapp/translations/en.json
index af3d8c5..48dbeab 100644
--- a/guacamole/src/main/webapp/translations/en.json
+++ b/guacamole/src/main/webapp/translations/en.json
@@ -42,6 +42,7 @@
 
         "INFO_ACTIVE_USER_COUNT" : "Currently in use by {USERS} {USERS, plural, one{user} other{users}}.",
 
+        "TEXT_ANONYMOUS_USER"   : "Anonymous",
         "TEXT_HISTORY_DURATION" : "{VALUE} {UNIT, select, second{{VALUE, plural, one{second} other{seconds}}} minute{{VALUE, plural, one{minute} other{minutes}}} hour{{VALUE, plural, one{hour} other{hours}}} day{{VALUE, plural, one{day} other{days}}} other{}}"
 
     },
@@ -166,6 +167,12 @@
 
     },
 
+    "LIST" : {
+
+        "TEXT_ANONYMOUS_USER" : "Anonymous"
+
+    },
+
     "LOGIN": {
 
         "ACTION_ACKNOWLEDGE" : "@:APP.ACTION_ACKNOWLEDGE",


[5/8] incubator-guacamole-client git commit: GUACAMOLE-78: Store anonymous users' authentication results in memory only. Do not persist via cookie.

Posted by jm...@apache.org.
GUACAMOLE-78: Store anonymous users' authentication results in memory only. Do not persist via cookie.

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

Branch: refs/heads/master
Commit: 225736d2373c9035083b11198c08993f6e494d1c
Parents: 22b3e26
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 12 14:49:37 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Aug 12 14:49:37 2016 -0700

----------------------------------------------------------------------
 .../app/auth/service/authenticationService.js   | 31 +++++++++++++++++---
 1 file changed, 27 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/225736d2/guacamole/src/main/webapp/app/auth/service/authenticationService.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/auth/service/authenticationService.js b/guacamole/src/main/webapp/app/auth/service/authenticationService.js
index e6fc0d7..74f0570 100644
--- a/guacamole/src/main/webapp/app/auth/service/authenticationService.js
+++ b/guacamole/src/main/webapp/app/auth/service/authenticationService.js
@@ -54,6 +54,14 @@ angular.module('auth').factory('authenticationService', ['$injector',
     var service = {};
 
     /**
+     * The most recent authentication result, or null if no authentication
+     * result is cached.
+     *
+     * @type AuthenticationResult
+     */
+    var cachedResult = null;
+
+    /**
      * The unique identifier of the local cookie which stores the result of the
      * last authentication attempt.
      *
@@ -72,12 +80,17 @@ angular.module('auth').factory('authenticationService', ['$injector',
      */
     var getAuthenticationResult = function getAuthenticationResult() {
 
+        // Use cached result, if any
+        if (cachedResult)
+            return cachedResult;
+
         // Return explicit null if no auth data is currently stored
         var data = $cookieStore.get(AUTH_COOKIE_ID);
         if (!data)
             return null;
 
-        return new AuthenticationResult(data);
+        // Update cache and return retrieved auth result
+        return (cachedResult = new AuthenticationResult(data));
 
     };
 
@@ -92,12 +105,22 @@ angular.module('auth').factory('authenticationService', ['$injector',
     var setAuthenticationResult = function setAuthenticationResult(data) {
 
         // Clear the currently-stored result if the last attempt failed
-        if (!data)
+        if (!data) {
+            cachedResult = null;
             $cookieStore.remove(AUTH_COOKIE_ID);
+        }
 
         // Otherwise store the authentication attempt directly
-        else
-            $cookieStore.put(AUTH_COOKIE_ID, data);
+        else {
+
+            // Always store in cache
+            cachedResult = data;
+
+            // Store cookie ONLY if not anonymous
+            if (data.username !== AuthenticationResult.ANONYMOUS_USERNAME)
+                $cookieStore.put(AUTH_COOKIE_ID, data);
+
+        }
 
     };
 


[3/8] incubator-guacamole-client git commit: GUACAMOLE-78: Do not display user menu for anonymous users.

Posted by jm...@apache.org.
GUACAMOLE-78: Do not display user menu for anonymous users.

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

Branch: refs/heads/master
Commit: c6323503d86520d0d261baea5a9cbe516f1c8dc9
Parents: df3f54a
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 12 13:55:59 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Aug 12 13:55:59 2016 -0700

----------------------------------------------------------------------
 .../webapp/app/navigation/directives/guacUserMenu.js   | 13 ++++++++++++-
 .../webapp/app/navigation/templates/guacUserMenu.html  |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/c6323503/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
index 249f217..f94d006 100644
--- a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
+++ b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
@@ -68,7 +68,18 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
             .then(function retrievedMainPages(pages) {
                 $scope.pages = pages;
             });
-            
+
+            /**
+             * Returns whether the current user has authenticated anonymously.
+             *
+             * @returns {Boolean}
+             *     true if the current user has authenticated anonymously, false
+             *     otherwise.
+             */
+            $scope.isAnonymous = function isAnonymous() {
+                return authenticationService.isAnonymous();
+            };
+
             /**
              * Logs out the current user, redirecting them to back to the root
              * after logout completes.

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/c6323503/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
index 351da0f..4ffd937 100644
--- a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
+++ b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html
@@ -1,4 +1,4 @@
-<div class="user-menu">
+<div class="user-menu" ng-show="!isAnonymous()">
     <guac-menu menu-title="username">
            
         <!-- Local actions -->


[2/8] incubator-guacamole-client git commit: GUACAMOLE-78: Report users authenticated via share keys as anonymous.

Posted by jm...@apache.org.
GUACAMOLE-78: Report users authenticated via share keys as anonymous.

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

Branch: refs/heads/master
Commit: df3f54a02d1a59e39b3c5cfb366436dddc58ecc4
Parents: fcefa7a
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 12 13:51:37 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Aug 12 13:51:37 2016 -0700

----------------------------------------------------------------------
 .../auth/jdbc/sharing/user/SharedAuthenticatedUser.java        | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/df3f54a0/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedAuthenticatedUser.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedAuthenticatedUser.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedAuthenticatedUser.java
index a50b625..701ffd5 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedAuthenticatedUser.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedAuthenticatedUser.java
@@ -19,7 +19,6 @@
 
 package org.apache.guacamole.auth.jdbc.sharing.user;
 
-import java.util.UUID;
 import org.apache.guacamole.auth.jdbc.user.RemoteAuthenticatedUser;
 import org.apache.guacamole.net.auth.AuthenticatedUser;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
@@ -61,7 +60,8 @@ public class SharedAuthenticatedUser extends RemoteAuthenticatedUser {
     /**
      * Creates a new SharedAuthenticatedUser associating the given user with
      * their corresponding credentials and share key. The identifier (username)
-     * of the user will be randomly generated.
+     * of the user will be the standard identifier for anonymous users as
+     * defined by the Guacamole extension API.
      *
      * @param authenticationProvider
      *     The AuthenticationProvider that has authenticated the given user.
@@ -77,7 +77,7 @@ public class SharedAuthenticatedUser extends RemoteAuthenticatedUser {
             Credentials credentials, String shareKey) {
         super(authenticationProvider, credentials);
         this.shareKey = shareKey;
-        this.identifier = UUID.randomUUID().toString();
+        this.identifier = AuthenticatedUser.ANONYMOUS_IDENTIFIER;
     }
 
     /**