You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by raziel2244 <el...@raziel.space> on 2019/04/24 12:15:14 UTC

Creating connections from external source

Hi I am in a situation where I have another webpage and I would like it to be
able to open a connection through guacamole by passing a
username,password,address etc over and open the connection in a new
tab/window. 

I thought maybe the quickconnect function would help but I'm unsure about
how to pass in the data I need for that to work in this way. Does anyone
know how I can set this up? 

Annoyingly Java is in my way as I tried to look at modifying the angular
module for quickconnect but don't know enough about Java and how it's using
the Javascript files to be able to do it myself.



--
Sent from: http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/

Re: Creating connections from external source

Posted by Nick Couchman <vn...@apache.org>.
On Wed, Apr 24, 2019 at 8:15 AM raziel2244 <el...@raziel.space> wrote:

> Hi I am in a situation where I have another webpage and I would like it to
> be
> able to open a connection through guacamole by passing a
> username,password,address etc over and open the connection in a new
> tab/window.
>
> I thought maybe the quickconnect function would help but I'm unsure about
> how to pass in the data I need for that to work in this way. Does anyone
> know how I can set this up?
>
> Annoyingly Java is in my way as I tried to look at modifying the angular
> module for quickconnect but don't know enough about Java and how it's using
> the Javascript files to be able to do it myself.
>
>
>
The AngularJS components are the web application that runs in the user's
browser.  These interface with the Java components via a REST interface.
The QuickConnect module uses a REST endpoint to create the connection and
then the user gets redirected to the created connection.  I would imagine
this would work for what you're trying to do, although it might be a bit
overkill.

The relevant lines for creating the connection are here:

https://github.com/apache/guacamole-client/blob/3c9f880cb080dc57003a2869996d3f00536f6374/extensions/guacamole-auth-quickconnect/src/main/resources/services/quickConnectService.js#L43-L66

Basically, this function does a POST of data to the
api/session/ext/quickconnect/create
endpoint, with the Guacamole token (from the current login) and then a
single form parameter, the URI of the connection you're creating.  It
returns the connection identifier, which can then be used to access the URL
for the connection.  The code for redirecting after the connection is
successfully created is here:

https://github.com/apache/guacamole-client/blob/3c9f880cb080dc57003a2869996d3f00536f6374/extensions/guacamole-auth-quickconnect/src/main/resources/controllers/quickconnectController.js#L44-L53

It's worth noting that utilizing this code shouldn't require any knowledge
or tinkering with the Java back-end - if you use this the same way that the
AngularJS portion of the QuickConnect extension does, then the back-end
implementation shouldn't be of any concern.

-Nick