Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/194#discussion_r161610676
  
    --- Diff: 
guacamole-ext/src/main/java/org/apache/guacamole/token/PromptEntry.java ---
    @@ -0,0 +1,124 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package org.apache.guacamole.token;
    +
    +import java.util.Collections;
    +import java.util.HashMap;
    +import java.util.List;
    +import java.util.Map;
    +import org.apache.guacamole.form.Field;
    +
    +/**
    + * A class that collects all of the information required to
    + * to display a prompt to the user during client connection.
    + */
    +public class PromptEntry {
    --- End diff --
    
    So, the main point is to provide a data structure that can then be 
presented by the REST API such that the front-end application can provide a 
list of fields where prompts are necessary.  The `Field` is tracked so that we 
know both the name and the type of entry this should be (text vs. password vs. 
number, etc.), and the `positions` is so that you can cope with the following 
possible scenarios:
    - The entire field (e.g. username) is being prompted.
    - One or more positions within a field are being prompted.  The idea here 
is that there may be some text within a parameter, such as a filesystem 
location or directory path, that I want to hard-code as the administrator, 
while I want the user to be able to provide some sort of input to the field.  
As an example, let's say I want to prompt the user for a folder within their 
home directory that they want to pass through to a RDP connection - the text in 
the connection configuration might be:
    
    `/home/${GUAC_USERNAME}/${GUAC_PROMPT}`
    
    Or, perhaps you want to allow them to enter a hostname for a server, but 
within a defined range of servers.  You might do:
    
    `vdi-${GUAC_PROMPT}.example.com`
    
    or:
    
    `${GUAC_PROMPT}.vdi.example.com`
    
    Thus, the user would not be allowed to override everything about that 
parameter, just provide some input within a scope that the administrator has 
defined.


---

Reply via email to