AW: Additional field (select options) on login screen?

2022-12-15 Thread Joachim Lindenberg
Learned more – this depends on the exception I throw. I was using 
GuacamoleInsufficientCredentialsException, but 
GuacamoleInvalidCredentialsException works a lot better.

Joachim

 

Von: Joachim Lindenberg  
Gesendet: Donnerstag, 15. Dezember 2022 09:28
An: user@guacamole.apache.org
Betreff: AW: Additional field (select options) on login screen?

 

I got this kind of resolved by using redundant URL parameter names but then 
discovered that Guacamole uses different classes initial vs continuation that 
actually have different boxes, spacing, etc.. 

Can this be turned off easily from an extension (the “hard” way is modifying 
html dom at runtime)?

Thanks,

Joachim

 

 

Von: Joachim Lindenberg mailto:guacam...@lindenberg.one> > 
Gesendet: Dienstag, 13. Dezember 2022 17:32
An: user@guacamole.apache.org <mailto:user@guacamole.apache.org> 
Betreff: AW: Additional field (select options) on login screen?

 

Hello Mike,

I ran through an AngularJS course and with some more experiments I got the 
field to work, except for the second issue, the field missing when prefilled. 
Is this Guacamole or AngularJS?

Any suggestion what to look for?

Thanks, 
Joachim

 

Von: Joachim Lindenberg mailto:guacam...@lindenberg.one> > 
Gesendet: Montag, 12. Dezember 2022 23:16
An: user@guacamole.apache.org <mailto:user@guacamole.apache.org> 
Betreff: AW: Additional field (select options) on login screen?

 

Hello Mike,

I got my module, config, and controller to load – seeing console.log() output.

I am struggling with two issues right now:

*   While rendering the template I want to call methods in my controller, 
similar to ng-options="option as getFieldOption(option)" I have seen in other 
places. Unfortunately when I add this to my template, I always get an exception 
rather than a call to a controller method. How is this supposed to work? I have 
to admin I am newbie in ng and also unsure what is guacamole, what ng…
*   When I add my field/parameter name to the URL, the field gets omitted 
while rendering. How can I turn this off as I´d prefer that to be just a 
default?

Thanks, 
Joachim

 

 

Von: Michael Jumper mailto:mjum...@apache.org> > 
Gesendet: Freitag, 9. Dezember 2022 02:25
An: user@guacamole.apache.org <mailto:user@guacamole.apache.org> 
Betreff: Re: Additional field (select options) on login screen?

 

On Thu, Dec 8, 2022 at 8:34 AM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello Mike,

thanks for that. I started trying out that route. I figured out I probably
also need an html template, a controller, probably additions to manifest,
but cannot get the field to be displayed yet, and also don´t see any errors
in the browsers console I can attribute to that. I enabled debug logging in
guacamole container. I can tell that my module.js (referenced from manifest)
is included and executes, but I cannot find my config, controller and
template within the network trace. Should they be included in manifest (totp
doesn´t)?

 

Everything has to be in the manifest somehow. The TOTP support doesn't include 
those specific files in the manifest because part of that extension's build 
process is JavaScript minification and concatenation. They're there implicitly 
via the single file that it does include.

 

Any tip what to watch out for? Is there any debug support for the browser
parts?

 

You need to make sure your module is added as a dependency of the "index" 
module or your module's config, etc. will not be loaded with the rest of the 
app. You need to also make sure that all relevant files are part of the 
manifest (either through being explicitly included or through a concatenation 
step). You should also double check that the field type name defined in the 
Java half of your field exactly matches the field type name that you're 
registering - if they don't match, the webapp won't be able to locate and 
render your field.

 

If things still are not behaving as expected, I recommend adding some 
console.log() calls around the various parts of your code to see what files are 
loaded vs. not, what parts of your module are loaded vs. not, etc. That might 
give you an idea where to look for the problem.

 

- Mike

 



AW: Additional field (select options) on login screen?

2022-12-15 Thread Joachim Lindenberg
I got this kind of resolved by using redundant URL parameter names but then 
discovered that Guacamole uses different classes initial vs continuation that 
actually have different boxes, spacing, etc.. 

Can this be turned off easily from an extension (the “hard” way is modifying 
html dom at runtime)?

Thanks,

Joachim

 

 

Von: Joachim Lindenberg  
Gesendet: Dienstag, 13. Dezember 2022 17:32
An: user@guacamole.apache.org
Betreff: AW: Additional field (select options) on login screen?

 

Hello Mike,

I ran through an AngularJS course and with some more experiments I got the 
field to work, except for the second issue, the field missing when prefilled. 
Is this Guacamole or AngularJS?

Any suggestion what to look for?

Thanks, 
Joachim

 

Von: Joachim Lindenberg mailto:guacam...@lindenberg.one> > 
Gesendet: Montag, 12. Dezember 2022 23:16
An: user@guacamole.apache.org <mailto:user@guacamole.apache.org> 
Betreff: AW: Additional field (select options) on login screen?

 

Hello Mike,

I got my module, config, and controller to load – seeing console.log() output.

I am struggling with two issues right now:

*   While rendering the template I want to call methods in my controller, 
similar to ng-options="option as getFieldOption(option)" I have seen in other 
places. Unfortunately when I add this to my template, I always get an exception 
rather than a call to a controller method. How is this supposed to work? I have 
to admin I am newbie in ng and also unsure what is guacamole, what ng…
*   When I add my field/parameter name to the URL, the field gets omitted 
while rendering. How can I turn this off as I´d prefer that to be just a 
default?

Thanks, 
Joachim

 

 

Von: Michael Jumper mailto:mjum...@apache.org> > 
Gesendet: Freitag, 9. Dezember 2022 02:25
An: user@guacamole.apache.org <mailto:user@guacamole.apache.org> 
Betreff: Re: Additional field (select options) on login screen?

 

On Thu, Dec 8, 2022 at 8:34 AM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello Mike,

thanks for that. I started trying out that route. I figured out I probably
also need an html template, a controller, probably additions to manifest,
but cannot get the field to be displayed yet, and also don´t see any errors
in the browsers console I can attribute to that. I enabled debug logging in
guacamole container. I can tell that my module.js (referenced from manifest)
is included and executes, but I cannot find my config, controller and
template within the network trace. Should they be included in manifest (totp
doesn´t)?

 

Everything has to be in the manifest somehow. The TOTP support doesn't include 
those specific files in the manifest because part of that extension's build 
process is JavaScript minification and concatenation. They're there implicitly 
via the single file that it does include.

 

Any tip what to watch out for? Is there any debug support for the browser
parts?

 

You need to make sure your module is added as a dependency of the "index" 
module or your module's config, etc. will not be loaded with the rest of the 
app. You need to also make sure that all relevant files are part of the 
manifest (either through being explicitly included or through a concatenation 
step). You should also double check that the field type name defined in the 
Java half of your field exactly matches the field type name that you're 
registering - if they don't match, the webapp won't be able to locate and 
render your field.

 

If things still are not behaving as expected, I recommend adding some 
console.log() calls around the various parts of your code to see what files are 
loaded vs. not, what parts of your module are loaded vs. not, etc. That might 
give you an idea where to look for the problem.

 

- Mike

 



AW: Additional field (select options) on login screen?

2022-12-13 Thread Joachim Lindenberg
Hello Mike,

I ran through an AngularJS course and with some more experiments I got the 
field to work, except for the second issue, the field missing when prefilled. 
Is this Guacamole or AngularJS?

Any suggestion what to look for?

Thanks, 
Joachim

 

Von: Joachim Lindenberg  
Gesendet: Montag, 12. Dezember 2022 23:16
An: user@guacamole.apache.org
Betreff: AW: Additional field (select options) on login screen?

 

Hello Mike,

I got my module, config, and controller to load – seeing console.log() output.

I am struggling with two issues right now:

*   While rendering the template I want to call methods in my controller, 
similar to ng-options="option as getFieldOption(option)" I have seen in other 
places. Unfortunately when I add this to my template, I always get an exception 
rather than a call to a controller method. How is this supposed to work? I have 
to admin I am newbie in ng and also unsure what is guacamole, what ng…
*   When I add my field/parameter name to the URL, the field gets omitted 
while rendering. How can I turn this off as I´d prefer that to be just a 
default?

Thanks, 
Joachim

 

 

Von: Michael Jumper mailto:mjum...@apache.org> > 
Gesendet: Freitag, 9. Dezember 2022 02:25
An: user@guacamole.apache.org <mailto:user@guacamole.apache.org> 
Betreff: Re: Additional field (select options) on login screen?

 

On Thu, Dec 8, 2022 at 8:34 AM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello Mike,

thanks for that. I started trying out that route. I figured out I probably
also need an html template, a controller, probably additions to manifest,
but cannot get the field to be displayed yet, and also don´t see any errors
in the browsers console I can attribute to that. I enabled debug logging in
guacamole container. I can tell that my module.js (referenced from manifest)
is included and executes, but I cannot find my config, controller and
template within the network trace. Should they be included in manifest (totp
doesn´t)?

 

Everything has to be in the manifest somehow. The TOTP support doesn't include 
those specific files in the manifest because part of that extension's build 
process is JavaScript minification and concatenation. They're there implicitly 
via the single file that it does include.

 

Any tip what to watch out for? Is there any debug support for the browser
parts?

 

You need to make sure your module is added as a dependency of the "index" 
module or your module's config, etc. will not be loaded with the rest of the 
app. You need to also make sure that all relevant files are part of the 
manifest (either through being explicitly included or through a concatenation 
step). You should also double check that the field type name defined in the 
Java half of your field exactly matches the field type name that you're 
registering - if they don't match, the webapp won't be able to locate and 
render your field.

 

If things still are not behaving as expected, I recommend adding some 
console.log() calls around the various parts of your code to see what files are 
loaded vs. not, what parts of your module are loaded vs. not, etc. That might 
give you an idea where to look for the problem.

 

- Mike

 



AW: Additional field (select options) on login screen?

2022-12-12 Thread Joachim Lindenberg
Hello Mike,

I got my module, config, and controller to load – seeing console.log() output.

I am struggling with two issues right now:

*   While rendering the template I want to call methods in my controller, 
similar to ng-options="option as getFieldOption(option)" I have seen in other 
places. Unfortunately when I add this to my template, I always get an exception 
rather than a call to a controller method. How is this supposed to work? I have 
to admin I am newbie in ng and also unsure what is guacamole, what ng…
*   When I add my field/parameter name to the URL, the field gets omitted 
while rendering. How can I turn this off as I´d prefer that to be just a 
default?

Thanks, 
Joachim

 

 

Von: Michael Jumper  
Gesendet: Freitag, 9. Dezember 2022 02:25
An: user@guacamole.apache.org
Betreff: Re: Additional field (select options) on login screen?

 

On Thu, Dec 8, 2022 at 8:34 AM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello Mike,

thanks for that. I started trying out that route. I figured out I probably
also need an html template, a controller, probably additions to manifest,
but cannot get the field to be displayed yet, and also don´t see any errors
in the browsers console I can attribute to that. I enabled debug logging in
guacamole container. I can tell that my module.js (referenced from manifest)
is included and executes, but I cannot find my config, controller and
template within the network trace. Should they be included in manifest (totp
doesn´t)?

 

Everything has to be in the manifest somehow. The TOTP support doesn't include 
those specific files in the manifest because part of that extension's build 
process is JavaScript minification and concatenation. They're there implicitly 
via the single file that it does include.

 

Any tip what to watch out for? Is there any debug support for the browser
parts?

 

You need to make sure your module is added as a dependency of the "index" 
module or your module's config, etc. will not be loaded with the rest of the 
app. You need to also make sure that all relevant files are part of the 
manifest (either through being explicitly included or through a concatenation 
step). You should also double check that the field type name defined in the 
Java half of your field exactly matches the field type name that you're 
registering - if they don't match, the webapp won't be able to locate and 
render your field.

 

If things still are not behaving as expected, I recommend adding some 
console.log() calls around the various parts of your code to see what files are 
loaded vs. not, what parts of your module are loaded vs. not, etc. That might 
give you an idea where to look for the problem.

 

- Mike

 



AW: Additional field (select options) on login screen?

2022-12-08 Thread Joachim Lindenberg
Hello Mike,

thanks for that. I started trying out that route. I figured out I probably
also need an html template, a controller, probably additions to manifest,
but cannot get the field to be displayed yet, and also don´t see any errors
in the browsers console I can attribute to that. I enabled debug logging in
guacamole container. I can tell that my module.js (referenced from manifest)
is included and executes, but I cannot find my config, controller and
template within the network trace. Should they be included in manifest (totp
doesn´t)?

Any tip what to watch out for? Is there any debug support for the browser
parts?

Thanks, Joachim

 

 

Von: Michael Jumper  
Gesendet: Mittwoch, 7. Dezember 2022 06:08
An: user@guacamole.apache.org
Betreff: Re: Additional field (select options) on login screen?

 

There isn't currently any specific documentation on registering custom
field types, but there are some examples in the source that might be
instructive. You don't need to modify the guacamole-client source - there is
a system built-in intended for custom field types. You can do this purely
with an extension.

 

Take a look at the TOTP extension, which uses a fairly involved custom
field type for the enrollment process:

 

https://github.com/apache/guacamole-client/blob/master/extensions/guacamole
-auth-totp/src/main/java/org/apache/guacamole/auth/totp/form/AuthenticationC
odeField.java (Java definition)

 

https://github.com/apache/guacamole-client/blob/master/extensions/guacamole
-auth-totp/src/main/resources/config/totpConfig.js (JavaScript registration
of the type)

 

https://github.com/apache/guacamole-client/blob/master/extensions/guacamole
-auth-totp/src/main/resources/totpModule.js (JavaScript registration of the
AngularJS module handling the custom field registration)

 

The Java field will be automatically serialized into JSON, included in the
auth response, and then processed and passed to your custom field when
received by the browser.

 

The Duo extension also leverages custom fields for similar purposes.

 

- Mike

 

On Mon, Dec 5, 2022, 10:23 PM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello Mike,

is there any documentation or example on how to add a custom field type? I
assume this would require to clone or contribute to guacamole-client?

Thanks,
Joachim

 

Von: Michael Jumper <  mjum...@apache.org> 
Gesendet: Dienstag, 6. Dezember 2022 00:42
An:   user@guacamole.apache.org
Betreff: Re: Additional field (select options) on login screen?

 

On Mon, Dec 5, 2022 at 3:01 PM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello Mike,

 

I modified my code to show an addition filed using that exception, however
the result is not exactly what I was looking for.

With code like… 

 

   static final String backupserver = "backup-server-to-connect-to";

private static Field BACKUPSERVER = null;

private static CredentialsInfo SERVER_USERNAME_PASSWORD = null;

…

  if (BACKUPSERVER == null) BACKUPSERVER = new EnumField(backupserver,
getBackupServerCollection());

  if (SERVER_USERNAME_PASSWORD == null) SERVER_USERNAME_PASSWORD =

new CredentialsInfo(Arrays.asList(

 BACKUPSERVER,

  CredentialsInfo.USERNAME,

  CredentialsInfo.PASSWORD

  ));

  throw new GuacamoleInsufficientCredentialsException ("server, user &
password required", SERVER_USERNAME_PASSWORD);

 

… I get a drop down with the content
LOGIN.FIELD_OPTION_BACKUP_SERVER_TO_CONNECT_TO_BACKUP2_LINDENBERG_ONE in the
UI.

Looks like the client application takes my field name and values,
concatenates them, and probably also tries to translate them, whereas I want
to use the Values in EnumField as provided. How can I achieve that?

 

You cannot do this with EnumField. All of the standard field types included
with Guacamole that allow you to specify possible values will expect
translation strings for each of those possible values. You would have to
define your own custom field type if you cannot provide translation strings
for the possible values ahead of time.

 

Is there some other UI element more appropriate?

 

Also while the exception provides an easy way to define fields, the
Credentials type does not reflect that. I figured out I have to use
something like

credentials.getRequest().getParameter(backupserver))

correct?

 

Yes, convenience functions are provided only for username and password. You
need to use the generic getParameter() for anything more specialized.

 

- Mike

 

<>
-
To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org
For additional commands, e-mail: user-h...@guacamole.apache.org

AW: Additional field (select options) on login screen?

2022-12-05 Thread Joachim Lindenberg
Hello Mike,

is there any documentation or example on how to add a custom field type? I 
assume this would require to clone or contribute to guacamole-client?

Thanks,
Joachim

 

Von: Michael Jumper  
Gesendet: Dienstag, 6. Dezember 2022 00:42
An: user@guacamole.apache.org
Betreff: Re: Additional field (select options) on login screen?

 

On Mon, Dec 5, 2022 at 3:01 PM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello Mike,

 

I modified my code to show an addition filed using that exception, however the 
result is not exactly what I was looking for.

With code like… 

 

   static final String backupserver = "backup-server-to-connect-to";

private static Field BACKUPSERVER = null;

private static CredentialsInfo SERVER_USERNAME_PASSWORD = null;

…

  if (BACKUPSERVER == null) BACKUPSERVER = new EnumField(backupserver, 
getBackupServerCollection());

  if (SERVER_USERNAME_PASSWORD == null) SERVER_USERNAME_PASSWORD =

new CredentialsInfo(Arrays.asList(

 BACKUPSERVER,

  CredentialsInfo.USERNAME,

  CredentialsInfo.PASSWORD

  ));

  throw new GuacamoleInsufficientCredentialsException ("server, user & 
password required", SERVER_USERNAME_PASSWORD);

 

… I get a drop down with the content 
LOGIN.FIELD_OPTION_BACKUP_SERVER_TO_CONNECT_TO_BACKUP2_LINDENBERG_ONE in the UI.

Looks like the client application takes my field name and values, concatenates 
them, and probably also tries to translate them, whereas I want to use the 
Values in EnumField as provided. How can I achieve that?

 

You cannot do this with EnumField. All of the standard field types included 
with Guacamole that allow you to specify possible values will expect 
translation strings for each of those possible values. You would have to define 
your own custom field type if you cannot provide translation strings for the 
possible values ahead of time.

 

Is there some other UI element more appropriate?

 

Also while the exception provides an easy way to define fields, the Credentials 
type does not reflect that. I figured out I have to use something like

credentials.getRequest().getParameter(backupserver))

correct?

 

Yes, convenience functions are provided only for username and password. You 
need to use the generic getParameter() for anything more specialized.

 

- Mike

 



AW: Additional field (select options) on login screen?

2022-12-05 Thread Joachim Lindenberg
Hello Mike,

 

I modified my code to show an addition filed using that exception, however the 
result is not exactly what I was looking for.

With code like… 

 

   static final String backupserver = "backup-server-to-connect-to";

private static Field BACKUPSERVER = null;

private static CredentialsInfo SERVER_USERNAME_PASSWORD = null;

…

  if (BACKUPSERVER == null) BACKUPSERVER = new EnumField(backupserver, 
getBackupServerCollection());

  if (SERVER_USERNAME_PASSWORD == null) SERVER_USERNAME_PASSWORD =

new CredentialsInfo(Arrays.asList(

 BACKUPSERVER,

  CredentialsInfo.USERNAME,

  CredentialsInfo.PASSWORD

  ));

  throw new GuacamoleInsufficientCredentialsException ("server, user & 
password required", SERVER_USERNAME_PASSWORD);

 

… I get a drop down with the content 
LOGIN.FIELD_OPTION_BACKUP_SERVER_TO_CONNECT_TO_BACKUP2_LINDENBERG_ONE in the UI.

Looks like the client application takes my field name and values, concatenates 
them, and probably also tries to translate them, whereas I want to use the 
Values in EnumField as provided. How can I achieve that? Is there some other UI 
element more appropriate?

 

Also while the exception provides an easy way to define fields, the Credentials 
type does not reflect that. I figured out I have to use something like

credentials.getRequest().getParameter(backupserver))

correct?

 

Thanks, Joachim

 

Von: Michael Jumper  
Gesendet: Montag, 5. Dezember 2022 19:25
An: user@guacamole.apache.org
Betreff: Re: Additional field (select options) on login screen?

 

You can accept arbitrary credentials as a part of the auth process. The content 
of the login screen is determined by the credentials requested by the 
GuacamoleInvalidCredentialsException thrown, so you would just include 
username, password, and the desired select field in the set of fields:

 

https://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/credentials/GuacamoleInvalidCredentialsException.html

 

A select field is represented by an EnumField:

 

https://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/form/EnumField.html

 

- Mike

 

On Mon, Dec 5, 2022, 9:42 AM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello Mike,

my current auth extension calls to my backup software (which also manages 
virtual machines created from backups), authenticates the user, and creates a 
list of configurations (existing vms or to-be-created-vms) for the user to pick 
from. As I am in fact running multiple backup servers, I want to allow the 
users to choose the server to use from a list that could be stored in 
guacamole.properties or similar.

Thanks,

Joachim

 

Von: Michael Jumper mailto:mjum...@apache.org> > 
Gesendet: Montag, 5. Dezember 2022 18:28
An: user@guacamole.apache.org  
Betreff: Re: Additional field (select options) on login screen?

 

On Mon, Dec 5, 2022, 9:26 AM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello,

I´d like to add an additional field to the login screen. The field should be a 
select option (at least that is the html I would use, regardless of how it is 
generated) and ideally the field can be prepopulated via the url (subject to 
available options).

To what end?

I assume something like this can be done via an authentication extension and I 
already have one, but so far it does not add the additional field, nor is clear 
to me, how to make any additional UI element depend on configuration or backend 
information.

What does your auth extension currently do?

 

- Mike

 



AW: Additional field (select options) on login screen?

2022-12-05 Thread Joachim Lindenberg
Hello Mike,

my current auth extension calls to my backup software (which also manages 
virtual machines created from backups), authenticates the user, and creates a 
list of configurations (existing vms or to-be-created-vms) for the user to pick 
from. As I am in fact running multiple backup servers, I want to allow the 
users to choose the server to use from a list that could be stored in 
guacamole.properties or similar.

Thanks,

Joachim

 

Von: Michael Jumper  
Gesendet: Montag, 5. Dezember 2022 18:28
An: user@guacamole.apache.org
Betreff: Re: Additional field (select options) on login screen?

 

On Mon, Dec 5, 2022, 9:26 AM Joachim Lindenberg mailto:guacam...@lindenberg.one> > wrote:

Hello,

I´d like to add an additional field to the login screen. The field should be a 
select option (at least that is the html I would use, regardless of how it is 
generated) and ideally the field can be prepopulated via the url (subject to 
available options).

To what end?

I assume something like this can be done via an authentication extension and I 
already have one, but so far it does not add the additional field, nor is clear 
to me, how to make any additional UI element depend on configuration or backend 
information.

What does your auth extension currently do?

 

- Mike