On Thu, Aug 1, 2024 at 7:10 AM David Lomas <d...@pale-eds.co.uk.invalid>
wrote:

> Hi Nick,
>
> I see from the dev group there's a lot of focus on the 1.6.0 release right
> now, but just wanted to post my progress here, and if you or anyone has
> time to confirm, that will at least save me the effort of continuing down a
> blind alley.
>
>
Hey, David,
Apologies for the lack of response - I've been traveling some lately, and
the day job was a bit busy there for a while, so I had not had time to sit
down and work through this. And, yes, we're pushing for the 1.6.0 release,
so a good deal of the time I've had to focus on Guacamole has gone into
trying to clean up things for that release :-).


> I've been able to create an auth extension which provides its own
> UserContext, and through the DecoratingDirectory class I can intercept the
> connect() method which actually comes from the load-balancing connection
> group feature of the jdbc extension. That function receives a
> GuacamoleClientInformation object and some tokens, but nothing about the
> remote end point. Calling super.connect() returns the GuacamoleTunnel which
> is established, but now we're no better off than using a listener for the
> TunnelConnect event; that class does not expose any information about the
> remote side. Interestingly, the tunnel is shown as an
> 'org.apache.guacamole.auth.jdbc.tunnel.ActiveConnectionRecord', but I've
> been unable to import any classes from the jdbc extension, and so can't use
> any of the methods on it. I'm not sure if that's as expected, or whether my
> environment isn't set up properly. I did try downloading the .jar for the
> jdbc extension, and although I can compile then, the code crashes at
> runtime.
>
>
A couple of things to consider:
* While ActiveConnectionRecord is a JDBC-specific class, it ultimately
implements the ConnectionRecord interface, which means you can call the
methods from that interface without the need to import the JDBC-specific
classes.
https://github.com/apache/guacamole-client/blob/main/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java
* If you do want to import the JDBC classes, make sure that you have the
JDBC extension included as a dependency in your pom.xml file.
* You might see if doing something with the getActiveConnectionDirectory()
method in your UserContext implementation would help you. I think there are
a couple of options that might work - the existing ActiveConnection
directory might allow you to pull what you need, or, alternatively, you
could try overriding the getActiveConnectionDirectory() call and
implementing your own directory and/or ActiveConnection class that wraps
the underlying ones and performs the actions you're looking to do.

I'm not _certain_ that any of these will actually get you where you want to
go, just throwing out ideas after looking at your requirements and the
code. You seem to be trying to do some things that I'm not sure were
completely thought of when the original code was written :-).


> I can get the tunnel UUID, and am wondering if I might then be able to use
> the REST API to get information about the remote end, since this is
> displayed in the admin UI? But that seems like a very round-about way of
> doing it. If the underlying GuacamoleTunnel had a method to expose the
> remote end info, that would be all we'd need...
>
>
Yes, you could do this, but if you can get the tunnel UUID, you can
probably get the tunnel without going around through the REST API - the
tunnel UUID itself isn't necessarily going to associate your active
connection with the underlying connection record.

-Nick

>

Reply via email to