mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-5: Verify sharing profile belongs to the requested connection.
This commit is contained in:
@@ -24,6 +24,7 @@ import java.util.Collections;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.apache.guacamole.auth.jdbc.user.AuthenticatedUser;
|
import org.apache.guacamole.auth.jdbc.user.AuthenticatedUser;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
|
import org.apache.guacamole.GuacamoleSecurityException;
|
||||||
import org.apache.guacamole.auth.jdbc.activeconnection.TrackedActiveConnection;
|
import org.apache.guacamole.auth.jdbc.activeconnection.TrackedActiveConnection;
|
||||||
import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
|
import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
|
||||||
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileService;
|
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileService;
|
||||||
@@ -105,6 +106,12 @@ public class ConnectionSharingService {
|
|||||||
sharingProfileService.retrieveObject(user,
|
sharingProfileService.retrieveObject(user,
|
||||||
sharingProfileIdentifier);
|
sharingProfileIdentifier);
|
||||||
|
|
||||||
|
// Verify that this profile is indeed a sharing profile for the
|
||||||
|
// requested connection
|
||||||
|
String connectionIdentifier = activeConnection.getConnectionIdentifier();
|
||||||
|
if (sharingProfile == null || !sharingProfile.getPrimaryConnectionIdentifier().equals(connectionIdentifier))
|
||||||
|
throw new GuacamoleSecurityException("Permission denied.");
|
||||||
|
|
||||||
// Generate a share key for the requested connection
|
// Generate a share key for the requested connection
|
||||||
String key = keyGenerator.getShareKey();
|
String key = keyGenerator.getShareKey();
|
||||||
connectionMap.put(key, new SharedConnectionDefinition(activeConnection,
|
connectionMap.put(key, new SharedConnectionDefinition(activeConnection,
|
||||||
|
Reference in New Issue
Block a user