On Wed, Nov 15, 2023 at 8:30 PM Mackie Gippets < techboard.soluti...@gmail.com> wrote:
> Hi Nick, > > Thank you for the insight. Apologies for not making myself clear the first > time. > > The first example you provided was on the right track. We need to be able > to insert a command line parameter into the initial-program parameter based > on the user account or other criterias. > > A common scenario is as follows: > > 1. User account1 is signing in from the web interface. > 2. Using Javascript, we determine whether account1 is using a desktop > browser or a mobile browser. > 3. If they are using a desktop browser, simply let account1 connect to the > connection profile they've been assigned to without modifying the > initial-program parameter. > 4. If they are using a mobile browser, insert a command line flag into the > initial-program parameter and let them connect with the modified parameter. > > I hope this makes sense. > Yes, it makes more sense. I think my initial approach would be the following: * Create a decorating extension that delegates most functionality to underlying extensions. This way you don't have to completely write all of the components of an authentication extension (connection storage, permissions management, etc.). * As part of the login process, grab the User Agent header, which also means making sure that Tomcat and your reverse proxy, if you use one, are configured to pass that information through. * Parse the User Agent header for mobile browsers. There's actually a site that includes detailed RegEx values for mobile browsers ( http://detectmobilebrowsers.com/). Not sure how current it is, might need some updating, and might need some cleaning out of stuff that isn't really around anymore, but may at least be a good starting place. Depending on exactly what about the browser you're interested in you can store this information in a variety of different ways. For example, if you just care about mobile vs. desktop, just make it a boolean. If you're interested in which mobile browser or desktop browser is in use, then maybe make an Enum that captures that information. * Create a Connection class that decorates existing connections, but, at some point, looks through the parameters and manipulates the "initial-program" parameter for any "RDP" connection, substituting in whatever value you'd like. You could probably either do this in the constructor for the decorating class, or you could do it at connection time, in the connect() method. * Depending on what you're trying to do, you might also be able to create a custom Parameter Token, like ${GUAC_USERNAME}, that would contain a value you'd want to substitute into the initial-program parameter. So, if your initial program is something like "c:\client.exe" and that takes an argument like "desktop" or "mobile". Your token could be ${GUAC_BROWSER} that contains either "desktop" or "mobile", so your initial-program would be: "c:\client.exe ${GUAC_BROWSER}". That's just my initial thought based on the information you've provided - I'm sure there are other approaches that'll work, and probably some better ones :-). -Nick >