@Path("sharingProfiles")
    public DirectoryResource<SharingProfile, APISharingProfile>
            getSharingProfileDirectoryResource() throws GuacamoleException {

        UserContext userContext = getUserContext();
        Connection connection = getInternalObject();
                
        // Produce subset of all SharingProfiles, containing only those which
        // are associated with this connection
        Directory<SharingProfile> sharingProfiles = new DirectoryView<>(
            userContext.getSharingProfileDirectory(),
            connection.getSharingProfileIdentifiers()
        );

        // Return a new resource which provides access to only those SharingProfiles
        return sharingProfileDirectoryResourceFactory.create(getAuthenticatedUser(), userContext, sharingProfiles);

    }
Returns a resource which provides read-only access to the subset of
SharingProfiles that the current user can use to share this connection.

@return
    A resource which provides read-only access to the subset of
    SharingProfiles that the current user can use to share this
    connection.

@throws GuacamoleException
    If the SharingProfiles associated with this connection cannot be
    retrieved.
guacamole/src/main/java/org/apache/guacamole/rest/connection/ConnectionResource.java