mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-680: Ensure the "guacLogout" event is specific to manual logouts.
This commit is contained in:
@@ -175,7 +175,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
|
|
||||||
// If an old token existed, request that the token be revoked
|
// If an old token existed, request that the token be revoked
|
||||||
if (currentToken) {
|
if (currentToken) {
|
||||||
service.logout().catch(angular.noop)
|
service.revokeToken(currentToken).catch(angular.noop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify of login and new token
|
// Notify of login and new token
|
||||||
@@ -252,6 +252,24 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes a request to revoke an authentication token using the token REST
|
||||||
|
* API endpoint, returning a promise succeeds only if the token was
|
||||||
|
* successfully revoked.
|
||||||
|
*
|
||||||
|
* @param {string} token
|
||||||
|
* The authentication token to revoke.
|
||||||
|
*
|
||||||
|
* @returns {Promise}
|
||||||
|
* A promise which succeeds only if the token was successfully revoked.
|
||||||
|
*/
|
||||||
|
service.revokeToken = function revokeToken(token) {
|
||||||
|
return requestService({
|
||||||
|
method: 'DELETE',
|
||||||
|
url: 'api/tokens/' + token
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a request to authenticate a user using the token REST API endpoint
|
* Makes a request to authenticate a user using the token REST API endpoint
|
||||||
* with a username and password, ignoring any currently-stored token,
|
* with a username and password, ignoring any currently-stored token,
|
||||||
@@ -276,7 +294,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a request to logout a user using the login REST API endpoint,
|
* Makes a request to logout a user using the token REST API endpoint,
|
||||||
* returning a promise succeeds only if the logout operation was
|
* returning a promise succeeds only if the logout operation was
|
||||||
* successful.
|
* successful.
|
||||||
*
|
*
|
||||||
@@ -294,10 +312,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
$rootScope.$broadcast('guacLogout', token);
|
$rootScope.$broadcast('guacLogout', token);
|
||||||
|
|
||||||
// Delete old token
|
// Delete old token
|
||||||
return requestService({
|
return service.revokeToken(token);
|
||||||
method: 'DELETE',
|
|
||||||
url: 'api/tokens/' + token
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user