Package org.glyptodon.guacamole

Examples of org.glyptodon.guacamole.GuacamoleSecurityException


            Integer connection_group_id = Integer.valueOf(permission.getObjectIdentifier());

            // Throw exception if permission to administer this connection group
            // is not granted
            if (!administerableConnectionGroupIDs.contains(connection_group_id))
                throw new GuacamoleSecurityException(
                      "User #" + this.user_id
                    + " does not have permission to administrate connection group"
                    + permission.getObjectIdentifier());

            // Create new permission
View Full Code Here


            Integer connection_id = Integer.valueOf(permission.getObjectIdentifier());

            // Verify that the user actually has permission to administrate
            // every one of these connections
            if (!administerableConnectionIDs.contains(connection_id))
                throw new GuacamoleSecurityException(
                      "User #" + this.user_id
                    + " does not have permission to administrate connection "
                    + permission.getObjectIdentifier());

            ConnectionPermissionExample connectionPermissionExample = new ConnectionPermissionExample();
View Full Code Here

            Integer connection_group_id = Integer.valueOf(permission.getObjectIdentifier());

            // Verify that the user actually has permission to administrate
            // every one of these connection groups
            if (!administerableConnectionGroupIDs.contains(connection_group_id))
                throw new GuacamoleSecurityException(
                      "User #" + this.user_id
                    + " does not have permission to administrate connection group"
                    + permission.getObjectIdentifier());

            ConnectionGroupPermissionExample connectionGroupPermissionExample = new ConnectionGroupPermissionExample();
View Full Code Here

    }

    @Override
    public void move(String identifier, Directory<String, User> groupIdentifier)
            throws GuacamoleException {
        throw new GuacamoleSecurityException("Permission denied.");
    }
View Full Code Here

    public static GuacamoleTunnel createTunnel(TunnelRequest request)
            throws GuacamoleException {

        HttpSession httpSession = request.getSession();
        if (httpSession == null)
            throw new GuacamoleSecurityException("Cannot connect - user not logged in.");

        // Get listeners
        final SessionListenerCollection listeners;
        try {
            listeners = new SessionListenerCollection(httpSession);
        }
        catch (GuacamoleException e) {
            logger.error("Creation of tunnel to guacd aborted: Failed to retrieve listeners: {}", e.getMessage());
            logger.debug("Error retrieving listeners.", e);
            throw e;
        }

        // Get ID of connection
        String id = request.getParameter("id");
        TunnelRequest.IdentifierType id_type = TunnelRequest.IdentifierType.getType(id);

        // Do not continue if unable to determine type
        if (id_type == null)
            throw new GuacamoleClientException("Illegal identifier - unknown type.");

        // Remove prefix
        id = id.substring(id_type.PREFIX.length());

        // Get credentials
        final Credentials credentials = AuthenticatingFilter.getCredentials(httpSession);

        // Get context
        final UserContext context = AuthenticatingFilter.getUserContext(httpSession);

        // If no context or no credentials, not logged in
        if (context == null || credentials == null)
            throw new GuacamoleSecurityException("Cannot connect - user not logged in.");

        // Get clipboard
        final ClipboardState clipboard = AuthenticatingFilter.getClipboardState(httpSession);

        // Get client information
        GuacamoleClientInformation info = new GuacamoleClientInformation();

        // Set width if provided
        String width  = request.getParameter("width");
        if (width != null)
            info.setOptimalScreenWidth(Integer.parseInt(width));

        // Set height if provided
        String height = request.getParameter("height");
        if (height != null)
            info.setOptimalScreenHeight(Integer.parseInt(height));

        // Set resolution if provided
        String dpi = request.getParameter("dpi");
        if (dpi != null)
            info.setOptimalResolution(Integer.parseInt(dpi));

        // Add audio mimetypes
        List<String> audio_mimetypes = request.getParameterValues("audio");
        if (audio_mimetypes != null)
            info.getAudioMimetypes().addAll(audio_mimetypes);

        // Add video mimetypes
        List<String> video_mimetypes = request.getParameterValues("video");
        if (video_mimetypes != null)
            info.getVideoMimetypes().addAll(video_mimetypes);

        // Create connected socket from identifier
        GuacamoleSocket socket;
        switch (id_type) {

            // Connection identifiers
            case CONNECTION: {

                // Get connection directory
                Directory<String, Connection> directory =
                    context.getRootConnectionGroup().getConnectionDirectory();

                // Get authorized connection
                Connection connection = directory.get(id);
                if (connection == null) {
                    logger.info("Connection \"{}\" does not exist for user \"{}\".", id, context.self().getUsername());
                    throw new GuacamoleSecurityException("Requested connection is not authorized.");
                }

                // Connect socket
                socket = connection.connect(info);
                logger.info("User \"{}\" successfully connected to \"{}\".", context.self().getUsername(), id);
                break;
            }

            // Connection group identifiers
            case CONNECTION_GROUP: {

                // Get connection group directory
                Directory<String, ConnectionGroup> directory =
                    context.getRootConnectionGroup().getConnectionGroupDirectory();

                // Get authorized connection group
                ConnectionGroup group = directory.get(id);
                if (group == null) {
                    logger.info("Connection group \"{}\" does not exist for user \"{}\".", id, context.self().getUsername());
                    throw new GuacamoleSecurityException("Requested connection group is not authorized.");
                }

                // Connect socket
                socket = group.connect(info);
                logger.info("User \"{}\" successfully connected to group \"{}\".", context.self().getUsername(), id);
View Full Code Here

            }
            else
                user = context.self();
           
            if (user == null)
                throw new GuacamoleSecurityException("No such user.");

            // Write XML content type
            response.setHeader("Content-Type", "text/xml");

            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
View Full Code Here

    }

    @Override
    public void add(ConnectionGroup connectionGroup)
            throws GuacamoleException {
        throw new GuacamoleSecurityException("Permission denied.");
    }
View Full Code Here

    }

    @Override
    public void update(ConnectionGroup connectionGroup)
            throws GuacamoleException {
        throw new GuacamoleSecurityException("Permission denied.");
    }
View Full Code Here

        throw new GuacamoleSecurityException("Permission denied.");
    }

    @Override
    public void remove(String identifier) throws GuacamoleException {
        throw new GuacamoleSecurityException("Permission denied.");
    }
View Full Code Here

    }

    @Override
    public void move(String identifier, Directory<String, ConnectionGroup> directory)
            throws GuacamoleException {
        throw new GuacamoleSecurityException("Permission denied.");
    }
View Full Code Here

TOP

Related Classes of org.glyptodon.guacamole.GuacamoleSecurityException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.