You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by mike-jumper <gi...@git.apache.org> on 2016/07/31 06:22:59 UTC

[GitHub] incubator-guacamole-client pull request #45: GUACAMOLE-5: Add support for mu...

GitHub user mike-jumper opened a pull request:

    https://github.com/apache/incubator-guacamole-client/pull/45

    GUACAMOLE-5: Add support for multiple share keys.

    This change (finally) leverages the changes from the other recent PRs to implement support for multiple share keys. Rather than create a `UserContext` which is restricted to a single connection (the connection associated with the share key), the initial share key only serves as the means of authentication if no other means has been used. Any further share keys received via new `Credentials` add further connections to the existing `UserContext`.
    
    This has the effect that:
    
    1. Legitimate users of the Guacamole system can use share keys without logging out first.
    2. Accessing a shared connection while logged in as a normal Guacamole user causes the correct username to be recorded in the history.
    3. Clicking a share key while already in a Guacamole session results in that connection being added to the existing session, rather than having no effect at all.
    
    This change also leverages the HTML patching features of the extension subsystem to add a nifty "shared by" tag next to the shared connection in the home screen, now that such a thing can exist:
    
    ![shared-by-tag](https://cloud.githubusercontent.com/assets/4632905/17274944/29fe0d3a-56ac-11e6-8a71-7e482279a2c5.png)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mike-jumper/incubator-guacamole-client multiple-share-keys

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-guacamole-client/pull/45.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #45
    
----
commit 96094a1c5842b470356a35d7959fa22774e5b24f
Author: Michael Jumper <mj...@apache.org>
Date:   2016-07-29T21:36:11Z

    GUACAMOLE-5: Implement exposure of a dynamic set of share keys as connections within a connection directory.

commit ecaf5be84eb643b1bf9a697c77daae2845c5d3b2
Author: Michael Jumper <mj...@apache.org>
Date:   2016-07-29T22:33:13Z

    GUACAMOLE-5: Update the SharedUserContext whenever a new share key is used.

commit ff3c57dff058f0f19c2ef9381cf1f4c607c0ab19
Author: Michael Jumper <mj...@apache.org>
Date:   2016-07-30T00:47:16Z

    GUACAMOLE-5: Display the username of the user that shares a connection.

commit c2f429360ca96a2b0e0198f83c864dc2a76213f9
Author: Michael Jumper <mj...@apache.org>
Date:   2016-07-30T06:05:27Z

    GUACAMOLE-5: Use connection name for SharedConnection, not sharing profile name.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-guacamole-client pull request #45: GUACAMOLE-5: Add support for mu...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/incubator-guacamole-client/pull/45#discussion_r72907054
  
    --- Diff: extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connectiongroup/SharedRootConnectionGroup.java ---
    @@ -0,0 +1,144 @@
    +/*
    + * 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.auth.jdbc.sharing.connectiongroup;
    +
    +import org.apache.guacamole.auth.jdbc.sharing.user.SharedUserContext;
    +import java.util.Collections;
    +import java.util.Map;
    +import java.util.Set;
    +import org.apache.guacamole.GuacamoleException;
    +import org.apache.guacamole.GuacamoleSecurityException;
    +import org.apache.guacamole.net.GuacamoleTunnel;
    +import org.apache.guacamole.net.auth.Connection;
    +import org.apache.guacamole.net.auth.ConnectionGroup;
    +import org.apache.guacamole.net.auth.Directory;
    +import org.apache.guacamole.protocol.GuacamoleClientInformation;
    +
    +/**
    + * A ConnectionGroup implementation which contains all connections accessible
    + * via a given SharedUserContext. The identifier of a SharedRootConnectionGroup
    + * is statically defined, and all Connections which are intended to be contained
    + * within an instance of SharedRootConnectionGroup MUST return that identifier
    + * via getParentIdentifier().
    + *
    + * @author Michael Jumper
    + */
    +public class SharedRootConnectionGroup implements ConnectionGroup {
    +
    +    /**
    +     * The identifier of the root connection group. All Connections which are
    +     * intended to be contained within an instance of SharedRootConnectionGroup
    +     * MUST return this identifier via getParentIdentifier().
    +     */
    +    public static final String IDENTIFIER = "ROOT";
    +
    +    /**
    +     * The SharedUserContext through which this connection group is accessible.
    +     */
    +    private final SharedUserContext userContext;
    +
    +    /**
    +     * Creates a new SharedRootConnectionGroup which contains all connections
    +     * accessible via the given SharedUserContext. The SharedRootConnectionGroup
    +     * is backed by the SharedUserContext, and any changes to the connections
    +     * within the SharedUserContext are immediately reflected in the
    +     * SharedRootConnectionGroup.
    +     *
    +     * @param userContext
    +     *     The SharedUserContext which should back the new
    +     *     SharedRootConnectionGroup.
    +     */
    +    public SharedRootConnectionGroup(SharedUserContext userContext) {
    +        this.userContext = userContext;
    +    }
    +
    +    @Override
    +    public String getIdentifier() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setIdentifier(String identifier) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public String getName() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setName(String name) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public String getParentIdentifier() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setParentIdentifier(String parentIdentifier) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public GuacamoleTunnel connect(GuacamoleClientInformation info)
    +            throws GuacamoleException {
    +        throw new GuacamoleSecurityException("Permission denied.");
    +    }
    +
    +    @Override
    +    public Map<String, String> getAttributes() {
    +        return Collections.<String, String>emptyMap();
    +    }
    +
    +    @Override
    +    public void setAttributes(Map<String, String> attributes) {
    +        // Do nothing - no attributes supported
    +    }
    +
    +    @Override
    +    public int getActiveConnections() {
    +        return 0;
    +    }
    +
    +    @Override
    +    public void setType(Type type) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public Type getType() {
    +        return Type.BALANCING;
    --- End diff --
    
    This is bonkers, however. It should be `ORGANIZATIONAL`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-guacamole-client pull request #45: GUACAMOLE-5: Add support for mu...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/incubator-guacamole-client/pull/45#discussion_r72907051
  
    --- Diff: extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connectiongroup/SharedRootConnectionGroup.java ---
    @@ -0,0 +1,144 @@
    +/*
    + * 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.auth.jdbc.sharing.connectiongroup;
    +
    +import org.apache.guacamole.auth.jdbc.sharing.user.SharedUserContext;
    +import java.util.Collections;
    +import java.util.Map;
    +import java.util.Set;
    +import org.apache.guacamole.GuacamoleException;
    +import org.apache.guacamole.GuacamoleSecurityException;
    +import org.apache.guacamole.net.GuacamoleTunnel;
    +import org.apache.guacamole.net.auth.Connection;
    +import org.apache.guacamole.net.auth.ConnectionGroup;
    +import org.apache.guacamole.net.auth.Directory;
    +import org.apache.guacamole.protocol.GuacamoleClientInformation;
    +
    +/**
    + * A ConnectionGroup implementation which contains all connections accessible
    + * via a given SharedUserContext. The identifier of a SharedRootConnectionGroup
    + * is statically defined, and all Connections which are intended to be contained
    + * within an instance of SharedRootConnectionGroup MUST return that identifier
    + * via getParentIdentifier().
    + *
    + * @author Michael Jumper
    + */
    +public class SharedRootConnectionGroup implements ConnectionGroup {
    +
    +    /**
    +     * The identifier of the root connection group. All Connections which are
    +     * intended to be contained within an instance of SharedRootConnectionGroup
    +     * MUST return this identifier via getParentIdentifier().
    +     */
    +    public static final String IDENTIFIER = "ROOT";
    +
    +    /**
    +     * The SharedUserContext through which this connection group is accessible.
    +     */
    +    private final SharedUserContext userContext;
    +
    +    /**
    +     * Creates a new SharedRootConnectionGroup which contains all connections
    +     * accessible via the given SharedUserContext. The SharedRootConnectionGroup
    +     * is backed by the SharedUserContext, and any changes to the connections
    +     * within the SharedUserContext are immediately reflected in the
    +     * SharedRootConnectionGroup.
    +     *
    +     * @param userContext
    +     *     The SharedUserContext which should back the new
    +     *     SharedRootConnectionGroup.
    +     */
    +    public SharedRootConnectionGroup(SharedUserContext userContext) {
    +        this.userContext = userContext;
    +    }
    +
    +    @Override
    +    public String getIdentifier() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setIdentifier(String identifier) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public String getName() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setName(String name) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public String getParentIdentifier() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setParentIdentifier(String parentIdentifier) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public GuacamoleTunnel connect(GuacamoleClientInformation info)
    +            throws GuacamoleException {
    +        throw new GuacamoleSecurityException("Permission denied.");
    +    }
    +
    +    @Override
    +    public Map<String, String> getAttributes() {
    +        return Collections.<String, String>emptyMap();
    +    }
    +
    +    @Override
    +    public void setAttributes(Map<String, String> attributes) {
    +        // Do nothing - no attributes supported
    +    }
    +
    +    @Override
    +    public int getActiveConnections() {
    +        return 0;
    --- End diff --
    
    Simply because the number of active connections shared connections by a particular user is not tracked. From the definition of `getActiveConnections()` within `Connectable`:
    
    > Implementations may simply return 0 if this value is not tracked.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-guacamole-client pull request #45: GUACAMOLE-5: Add support for mu...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-guacamole-client/pull/45


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-guacamole-client pull request #45: GUACAMOLE-5: Add support for mu...

Posted by jmuehlner <gi...@git.apache.org>.
Github user jmuehlner commented on a diff in the pull request:

    https://github.com/apache/incubator-guacamole-client/pull/45#discussion_r72906901
  
    --- Diff: extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connectiongroup/SharedRootConnectionGroup.java ---
    @@ -0,0 +1,144 @@
    +/*
    + * 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.auth.jdbc.sharing.connectiongroup;
    +
    +import org.apache.guacamole.auth.jdbc.sharing.user.SharedUserContext;
    +import java.util.Collections;
    +import java.util.Map;
    +import java.util.Set;
    +import org.apache.guacamole.GuacamoleException;
    +import org.apache.guacamole.GuacamoleSecurityException;
    +import org.apache.guacamole.net.GuacamoleTunnel;
    +import org.apache.guacamole.net.auth.Connection;
    +import org.apache.guacamole.net.auth.ConnectionGroup;
    +import org.apache.guacamole.net.auth.Directory;
    +import org.apache.guacamole.protocol.GuacamoleClientInformation;
    +
    +/**
    + * A ConnectionGroup implementation which contains all connections accessible
    + * via a given SharedUserContext. The identifier of a SharedRootConnectionGroup
    + * is statically defined, and all Connections which are intended to be contained
    + * within an instance of SharedRootConnectionGroup MUST return that identifier
    + * via getParentIdentifier().
    + *
    + * @author Michael Jumper
    + */
    +public class SharedRootConnectionGroup implements ConnectionGroup {
    +
    +    /**
    +     * The identifier of the root connection group. All Connections which are
    +     * intended to be contained within an instance of SharedRootConnectionGroup
    +     * MUST return this identifier via getParentIdentifier().
    +     */
    +    public static final String IDENTIFIER = "ROOT";
    +
    +    /**
    +     * The SharedUserContext through which this connection group is accessible.
    +     */
    +    private final SharedUserContext userContext;
    +
    +    /**
    +     * Creates a new SharedRootConnectionGroup which contains all connections
    +     * accessible via the given SharedUserContext. The SharedRootConnectionGroup
    +     * is backed by the SharedUserContext, and any changes to the connections
    +     * within the SharedUserContext are immediately reflected in the
    +     * SharedRootConnectionGroup.
    +     *
    +     * @param userContext
    +     *     The SharedUserContext which should back the new
    +     *     SharedRootConnectionGroup.
    +     */
    +    public SharedRootConnectionGroup(SharedUserContext userContext) {
    +        this.userContext = userContext;
    +    }
    +
    +    @Override
    +    public String getIdentifier() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setIdentifier(String identifier) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public String getName() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setName(String name) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public String getParentIdentifier() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setParentIdentifier(String parentIdentifier) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public GuacamoleTunnel connect(GuacamoleClientInformation info)
    +            throws GuacamoleException {
    +        throw new GuacamoleSecurityException("Permission denied.");
    +    }
    +
    +    @Override
    +    public Map<String, String> getAttributes() {
    +        return Collections.<String, String>emptyMap();
    +    }
    +
    +    @Override
    +    public void setAttributes(Map<String, String> attributes) {
    +        // Do nothing - no attributes supported
    +    }
    +
    +    @Override
    +    public int getActiveConnections() {
    +        return 0;
    --- End diff --
    
    Why is this hardcoded to 0? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-guacamole-client pull request #45: GUACAMOLE-5: Add support for mu...

Posted by jmuehlner <gi...@git.apache.org>.
Github user jmuehlner commented on a diff in the pull request:

    https://github.com/apache/incubator-guacamole-client/pull/45#discussion_r72914173
  
    --- Diff: extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connectiongroup/SharedRootConnectionGroup.java ---
    @@ -0,0 +1,144 @@
    +/*
    + * 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.auth.jdbc.sharing.connectiongroup;
    +
    +import org.apache.guacamole.auth.jdbc.sharing.user.SharedUserContext;
    +import java.util.Collections;
    +import java.util.Map;
    +import java.util.Set;
    +import org.apache.guacamole.GuacamoleException;
    +import org.apache.guacamole.GuacamoleSecurityException;
    +import org.apache.guacamole.net.GuacamoleTunnel;
    +import org.apache.guacamole.net.auth.Connection;
    +import org.apache.guacamole.net.auth.ConnectionGroup;
    +import org.apache.guacamole.net.auth.Directory;
    +import org.apache.guacamole.protocol.GuacamoleClientInformation;
    +
    +/**
    + * A ConnectionGroup implementation which contains all connections accessible
    + * via a given SharedUserContext. The identifier of a SharedRootConnectionGroup
    + * is statically defined, and all Connections which are intended to be contained
    + * within an instance of SharedRootConnectionGroup MUST return that identifier
    + * via getParentIdentifier().
    + *
    + * @author Michael Jumper
    + */
    +public class SharedRootConnectionGroup implements ConnectionGroup {
    +
    +    /**
    +     * The identifier of the root connection group. All Connections which are
    +     * intended to be contained within an instance of SharedRootConnectionGroup
    +     * MUST return this identifier via getParentIdentifier().
    +     */
    +    public static final String IDENTIFIER = "ROOT";
    +
    +    /**
    +     * The SharedUserContext through which this connection group is accessible.
    +     */
    +    private final SharedUserContext userContext;
    +
    +    /**
    +     * Creates a new SharedRootConnectionGroup which contains all connections
    +     * accessible via the given SharedUserContext. The SharedRootConnectionGroup
    +     * is backed by the SharedUserContext, and any changes to the connections
    +     * within the SharedUserContext are immediately reflected in the
    +     * SharedRootConnectionGroup.
    +     *
    +     * @param userContext
    +     *     The SharedUserContext which should back the new
    +     *     SharedRootConnectionGroup.
    +     */
    +    public SharedRootConnectionGroup(SharedUserContext userContext) {
    +        this.userContext = userContext;
    +    }
    +
    +    @Override
    +    public String getIdentifier() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setIdentifier(String identifier) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public String getName() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setName(String name) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public String getParentIdentifier() {
    +        return IDENTIFIER;
    +    }
    +
    +    @Override
    +    public void setParentIdentifier(String parentIdentifier) {
    +        throw new UnsupportedOperationException("The root group is immutable.");
    +    }
    +
    +    @Override
    +    public GuacamoleTunnel connect(GuacamoleClientInformation info)
    +            throws GuacamoleException {
    +        throw new GuacamoleSecurityException("Permission denied.");
    +    }
    +
    +    @Override
    +    public Map<String, String> getAttributes() {
    +        return Collections.<String, String>emptyMap();
    +    }
    +
    +    @Override
    +    public void setAttributes(Map<String, String> attributes) {
    +        // Do nothing - no attributes supported
    +    }
    +
    +    @Override
    +    public int getActiveConnections() {
    +        return 0;
    --- End diff --
    
    Ok


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---