Sorry key for my map used is incorrect. It is not identifier, it is entry.getValue().getAuthenticatedUser().getCredentials().getUsername()
-----Mensaje original----- De: Gabriel Huerta Araujo Enviado el: martes, 20 de junio de 2023 06:33 p. m. Para: [email protected] Asunto: RE: Access to data associated to guac-organization from Java code >> You can view the guacamole-ext documentation here: >> https://guacamole.apache.org/doc/guacamole-ext/ >> The user's organization is an Attribute, so it'd be something like: >> GuacamoleSession session = entry.getValue(); >> tokens.put(entry.getKey(), >> session.getUserContext(session.getAuthenticatedUser().getAuthenticati >> onProvider().getIdentifier()).self().getAttributes(User.Attribute.ORG >> ANIZATION)); >> That's just a quick stab at it based on the class documentation, and >> without factoring in where you're running your getAllTokens() method, what >> permissions it is running with, and that there may be an easier way to get >> the information you're wanting. >> That said, I'm not sure why you're wanting to do what the code looks >> like you're doing - it looks to me like you'd end up with a set of >> Guacamole parameter tokens where the name is the session identifier >> (entry.getKey()) and the value is the organization the user belongs >> to. Since session identifiers are going to be random, this wouldn't be a >> very useful token for any configuration purposes - it'll be different for >> every single user, and different every time a user logs in.. >> Maybe you could describe, at a higher level, what you're trying to >> accomplish? Hi Nick, thanks a lot for your soon response. I want to create a REST Service call (GET), where Guacamole Application gives all users logged(sessionMap attribute(its keys) from HashTokenSessionMap class). First this call is going to be called from a script perl. One by one, by its identifier is going to be called other REST Service call (from TokenRESTService.java file). This last call, is also called from Perl script. @DELETE @Path("/{token}") public void invalidateToken(@PathParam("token") String authToken) throws GuacamoleException { // Invalidate session, if it exists if (!authenticationService.destroyGuacamoleSession(authToken)) throw new GuacamoleResourceNotFoundException("No such token."); } All this, in order to cancel users of the web application. This will be temporal, meanwhile I finish the logged in users page, similar to the active sessions page -Gabriel
