You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by Vieri <re...@yahoo.com.INVALID> on 2020/01/09 09:16:42 UTC

adding custom connection objects

Hi,

I'm having a bit of trouble understanding how to write an extension so that when a user logs in, custom objects are listed within the connection list. These objects are supposed to be mere URLs, and I want them to show up in the connection list as simple HREF links opening in new browser pages or tabs.

My authentication provider is LDAP, and ideally I'd like to create these URL objects in LDAP. However, since this route is a bit tedious and I'm running out of time, I was wondering if I could settle for simply "extending" the "home" web page where the connections are listed. I would simply set a fixed list of static href links for every user who successfully logs in. No need to provide connection objects.

So, I edited this file:

app/home/templates/home.html

and added something like this:

<div class="view" ng-class="{loading: !isLoaded()}">

    <div class="connection-list-ui">

        <!-- custom links -->
        <div class="header">
            <h2>WEB LINKS</h2>
        </div>
        <div class="all-connections">
            <ul>

                <li><a href="https://my.reverse.proxy1" target="_blank">Web site 1</a></li>
                <li><a href="https://my.reverse.proxy2" target="_blank">Web site 2</a></li>
            </ul>
        </div>

I'm modifying the code directly in the webapp folder just for testing purposes before writing an extension for it as a jar file.

Reloaded tomcat, but I'm not seeing the updated web page, as if the "WEB LINKS" section were not there.

What can I try?

Vieri

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
For additional commands, e-mail: user-help@guacamole.apache.org


Re: adding custom connection objects

Posted by Vieri <re...@yahoo.com.INVALID>.
 On Thursday, January 9, 2020, 11:37:10 PM GMT+1, Mike Jumper <mj...@apache.org> wrote: 
>
> I would recommend exposing a custom REST service which lists the desired URLs and leveraging an AngularJS directive to retrieve and render those URLs within the 
> Guacamole home page, as described above.

The picture is getting sharper. Thank you for the explanation!
I'll look into it.

Vieri




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
For additional commands, e-mail: user-help@guacamole.apache.org


Re: adding custom connection objects

Posted by Mike Jumper <mj...@apache.org>.
On Thu, Jan 9, 2020 at 1:28 PM Vieri <re...@yahoo.com.invalid> wrote:

>  On Thursday, January 9, 2020, 7:42:44 PM GMT+1, Nick Couchman <
> vnick@apache.org> wrote:
> >
> >This manual page describes the process of adding an extension, including
> modifying HTML:
> > http://guacamole.apache.org/doc/gug/guacamole-ext.html
>
> Yes, modifying static HTML is fine.
> However, I read that page where it says:
> "Extensions to Guacamole can:
> Provide alternative authentication methods and sources of connection/user
> data."
>
> I was wondering how to provide "connection data" ie. new HTTP URL objects
> at log-in time (so that different users can see different sets of URL
> links).


What you're looking for in this isn't a way to provide connection data,
which is a very specific thing and not a generic way to link to arbitrary
URLs, but a means of exposing arbitrary data from within your extension.
You can do this by exposing a REST service. For the data to be
user-specific, you would expose this REST service at the UserContext level:

http://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/UserContext.html#getResource--

See:

http://guacamole.apache.org/doc/gug/guacamole-ext.html#ext-rest-resources

You can then read from that resource using JavaScript and generate content
within the home screen. The best way to do that would probably be to use
your extension to add an AngularJS directive which renders the content
you're looking for, and then leverage the HTML patching system you're
already using to add HTML which refers to your directive.

The manual doesn't give a simple example, so I guess it must be tricky. Is
> the authentication provider rersponsible for creating/passing along these
> objects?


Connection data is exposed by the UserContext which is exposed by the
AuthenticationProvider, yes. It is also possible for
AuthenticationProviders to decorate the UserContext objects returned by
other AuthenticationProviders, augmenting their functionality. That said, I
don't believe this is what you should use here. Connection data is data for
Guacamole connections, not arbitrary links or URLs.

In other words, if I use the LDAP authentication provider, should I look
> into its code alone to see if I can generate my HTTP URLs? Or should this
> be done on the core guacamole-client code?


I would recommend exposing a custom REST service which lists the desired
URLs and leveraging an AngularJS directive to retrieve and render those
URLs within the Guacamole home page, as described above.

- Mike

Re: adding custom connection objects

Posted by Vieri <re...@yahoo.com.INVALID>.
 On Thursday, January 9, 2020, 7:42:44 PM GMT+1, Nick Couchman <vn...@apache.org> wrote: 
>
>This manual page describes the process of adding an extension, including modifying HTML:
> http://guacamole.apache.org/doc/gug/guacamole-ext.html

Yes, modifying static HTML is fine. 
However, I read that page where it says:
"Extensions to Guacamole can:
Provide alternative authentication methods and sources of connection/user data."

I was wondering how to provide "connection data" ie. new HTTP URL objects at log-in time (so that different users can see different sets of URL links). The manual doesn't give a simple example, so I guess it must be tricky. Is the authentication provider rersponsible for creating/passing along these objects? In other words, if I use the LDAP authentication provider, should I look into its code alone to see if I can generate my HTTP URLs? Or should this be done on the core guacamole-client code?

Vieri

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
For additional commands, e-mail: user-help@guacamole.apache.org


Re: adding custom connection objects

Posted by Nick Couchman <vn...@apache.org>.
On Thu, Jan 9, 2020 at 6:02 AM Vieri <re...@yahoo.com.invalid> wrote:

> Never mind. I had to make the jar file for it to work... Editing in-place
> does not do the job.
>
>
Yes, that is the correct way to do it - editing in place may work
temporarily, but as soon as the solution is redeployed it will get
overwritten.


> I used this as a simple HTML extension:
>
>
This manual page describes the process of adding an extension, including
modifying HTML:

http://guacamole.apache.org/doc/gug/guacamole-ext.html

-Nick

Re: adding custom connection objects

Posted by Vieri <re...@yahoo.com.INVALID>.
Never mind. I had to make the jar file for it to work... Editing in-place does not do the job.

I used this as a simple HTML extension:

<meta name="after" content=".all-connections">

<div class="header">
    <h2>Web Links</h2>
</div>
<div class="all-connections">
    <ul>
        <li><a href="https://my.reverse.proxy1" target="_blank">Web site 1</a></li>
        <li><a href="https://my.reverse.proxy2" target="_blank">Web site 2</a></li>
    </ul>
</div>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
For additional commands, e-mail: user-help@guacamole.apache.org