Class TokenInjectingConnection

    • Constructor Detail

      • TokenInjectingConnection

        public TokenInjectingConnection​(Connection connection,
                                        Map<String,​String> tokens)
        Wraps the given Connection, automatically adding the given tokens to each invocation of connect(). Any additional tokens which have the same name as existing tokens will override the existing values.
        Parameters:
        connection - The Connection to wrap.
        tokens - The additional tokens to include with each call to connect().
      • TokenInjectingConnection

        public TokenInjectingConnection​(Connection connection)
        Wraps the given Connection such that the additional parameter tokens added by addTokens(java.util.Map) or returned by getTokens() are included with each invocation of connect(). Any additional tokens which have the same name as existing tokens will override the existing values.
        Parameters:
        connection - The Connection to wrap.
    • Method Detail

      • getTokens

        protected Map<String,​String> getTokens()
                                              throws org.apache.guacamole.GuacamoleException
        Returns the tokens which should be added to an in-progress call to connect(). If not overridden, this function will return the tokens provided when this instance of TokenInjectingConnection was created. If the values of existing tokens need to be considered, implementations should override addTokens(java.util.Map) instead.
        Returns:
        The tokens which should be added to the in-progress call to connect().
        Throws:
        org.apache.guacamole.GuacamoleException - If the applicable tokens cannot be generated.
      • addTokens

        protected void addTokens​(Map<String,​String> tokens)
                          throws org.apache.guacamole.GuacamoleException
        Adds tokens to an in-progress call to connect(). If not overridden, this function will add the tokens returned by getTokens().
        Parameters:
        tokens - A modifiable Map containing the tokens already supplied to connect().
        Throws:
        org.apache.guacamole.GuacamoleException - If the applicable tokens cannot be generated.
      • connect

        public org.apache.guacamole.net.GuacamoleTunnel connect​(org.apache.guacamole.protocol.GuacamoleClientInformation info,
                                                                Map<String,​String> tokens)
                                                         throws org.apache.guacamole.GuacamoleException
        Description copied from interface: Connectable
        Establishes a connection to guacd using the information associated with this object. The connection will be provided the given client information. Implementations which support parameter tokens should apply the given tokens when configuring the connection, such as with a TokenFilter.
        Specified by:
        connect in interface Connectable
        Overrides:
        connect in class DelegatingConnection
        Parameters:
        info - Information associated with the connecting client.
        tokens - A Map containing the token names and corresponding values to be applied as parameter tokens when establishing the connection. If the implementation does not support parameter tokens, this Map may be ignored.
        Returns:
        A fully-established GuacamoleTunnel.
        Throws:
        org.apache.guacamole.GuacamoleException - If an error occurs while connecting to guacd, or if permission to connect is denied.
        See Also:
        Parameter Tokens