Hi,

Any inputs what am I missing in below code? This is written in my simple custom 
auth provider.

Regards,
Umesh
From: Umesh Bhatt <[email protected]>
Sent: Wednesday, December 11, 2019 11:29 AM
To: [email protected]
Subject: RE: Shared connection

Hi Nick,

I am trying to get active connections using below code but it is always fails 
and error details are not clear.
Also in connDir.getAll(null), we need to provide identifiers. Can you pls 
explain how to get this?

Regards,
Umesh

private void printActiveConnections(AuthenticatedUser usr) {
            try {
                  System.out.println("Listing active connections.");
                  if(usr == null) {
                        System.out.println("No user object.");
                        return;
                  }

                  System.out.println("usr = " + usr.getIdentifier());
                  UserContext ctxt = null;
                  try {
                        ctxt = getUserContext(usr);
                        if(ctxt == null) {
                              System.out.println("No user context.");
                              return;
                        }
                  } catch(GuacamoleException ex) {
                        System.out.println(ex.getMessage());
                  }

                  Directory<ActiveConnection> connDir = 
ctxt.getActiveConnectionDirectory();
                  if(connDir == null) {
                        System.out.println("No connection directory.");
                        return;
                  }

                  Collection<ActiveConnection> allConns = connDir.getAll(null);
                  if(allConns == null || allConns.isEmpty()) {
                        System.out.println("No active connections.");
                        return;
                  }

                  for(ActiveConnection conn : allConns) {
                        System.out.println("Conn Identifier = " + 
conn.getConnectionIdentifier() +
                                    " Identifier = " + conn.getIdentifier() +
                                    " Remote host = " + conn.getRemoteHost() +
                                    " Username = " + conn.getUsername());
                  }
            } catch (Exception ex) {
                  System.out.println("Error: " + ex.getMessage());
            }
      }

From: Nick Couchman <[email protected]<mailto:[email protected]>>
Sent: Wednesday, December 4, 2019 11:31 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: Shared connection

On Wed, Dec 4, 2019 at 5:46 AM Umesh Bhatt 
<[email protected]<mailto:[email protected]>> wrote:
Hi Nick,

Since currently it is not available, I am trying to implement in my custom auth 
provider.


Well, it isn't *released*, but it is available...in git master.  However, doing 
it in a custom authentication module should be fine, as well.

I am using GuacamoleConfiguration setConnectionId(ALREADY_ACTIVE_CONNECTION_ID) 
to join to existing active connection but not seeing it working.

What is ConnectionID, is it GUACD connection ID which is usually something like 
$7beb584d-d6e2-459d-86e9-e726091862cb?
If so how can I retrieve it in my code?


This is automatically generated when the connection is started, so you'll need 
to retrieve a list of active connections, which will give you the UUID 
(collection of random letters and numbers above) and then select the correct 
connection.

-Nick

Reply via email to