knacktim commented on pull request #573: URL: https://github.com/apache/guacamole-client/pull/573#issuecomment-763079018
@necouchman > I wonder if there is some other/better way to handle the case where a reload/redirect by a login handler causes the remaining ones to not be processed. It seems like just noting that in the documentation of the function could be confusing when it gets to the admin level and one or more modules (SSO logout, for example) causes another one to fail to actually run. I don't have any great ideas for how to handle that, so curious if we can brainstorm up some possible alternatives. I still don't have a good way to tackle this -- I am open to suggestions. After looking more at the documentation of $q.all() is that the following updates will get this to where we want this to be. The only problem that I see is that if ANY of the promises call `reject()` then it is unclear to me if $q.all will stop processing. (at least that is how I understood [this documentation](https://docs.angularjs.org/api/ng/service/$q#all:~:text=If%20any%20of%20the%20promises%20is,rejected%20with%20the%20same%20rejection%20value)) I updated the follow implementation for [GUACAMOLE-519] to use the new handler hooks. ```javascript angular.module('openid').run(['$routeParams', 'authenticationService', function openIDLogoutListener($routeParams, authenticationService) { let config = {} // TODO get these from backend authenticationService.registerLogoutHandler((resolve, reject) => { if ($routeParams && Object.prototype.hasOwnProperty.call($routeParams, 'id_token')) { $.get({ url: config['openid_logout_endpoint'], dataType: 'application/json', async: false, data: { client_id: config['openid_client_id'], id_token_hint: $routeParams.id_token }, success: function(resp) { resolve("Success"); }, error: function() { reject("Error when trying to log out"); } }) } }) }]); // Ensure the openid module is loaded along with the rest of the app angular.module('index').requires.push('openid'); ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
