From 089113c35264172531c2a9d05542a58c4c2542c4 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 29 Apr 2018 22:01:32 -0700 Subject: [PATCH] GUACAMOLE-526: Invoke logout() for the cached token BEFORE storing the new token. The logout() call erroneously invalidates the new token otherwise. --- .../main/webapp/app/auth/service/authenticationService.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/guacamole/src/main/webapp/app/auth/service/authenticationService.js b/guacamole/src/main/webapp/app/auth/service/authenticationService.js index a5c3ee45c..53b10c605 100644 --- a/guacamole/src/main/webapp/app/auth/service/authenticationService.js +++ b/guacamole/src/main/webapp/app/auth/service/authenticationService.js @@ -168,7 +168,6 @@ angular.module('auth').factory('authenticationService', ['$injector', .then(function authenticationSuccessful(data) { var currentToken = service.getCurrentToken(); - setAuthenticationResult(new AuthenticationResult(data)); // If a new token was received, ensure the old token is invalidated, // if any, and notify listeners of the new token @@ -180,10 +179,16 @@ angular.module('auth').factory('authenticationService', ['$injector', } // Notify of login and new token + setAuthenticationResult(new AuthenticationResult(data)); $rootScope.$broadcast('guacLogin', data.authToken); } + // Update cached authentication result, even if the token remains + // the same + else + setAuthenticationResult(new AuthenticationResult(data)); + // Authentication was successful return data;