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 <mjum...@apache.org> 
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 <guacam...@lindenberg.one 
<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 <mjum...@apache.org <mailto:mjum...@apache.org> > 
Gesendet: Montag, 5. Dezember 2022 18:28
An: user@guacamole.apache.org <mailto:user@guacamole.apache.org> 
Betreff: Re: Additional field (select options) on login screen?

 

On Mon, Dec 5, 2022, 9:26 AM Joachim Lindenberg <guacam...@lindenberg.one 
<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

 

Reply via email to