jmuehlner commented on code in PR #984:
URL: https://github.com/apache/guacamole-client/pull/984#discussion_r1612145837


##########
extensions/guacamole-auth-nextcloud/src/main/java/org/apache/guacamole/auth/nextcloud/connection/ConnectionService.java:
##########
@@ -0,0 +1,309 @@
+/*
+ * 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.nextcloud.connection;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.GuacamoleResourceNotFoundException;
+import org.apache.guacamole.GuacamoleServerException;
+import org.apache.guacamole.auth.nextcloud.user.UserData;
+import org.apache.guacamole.environment.Environment;
+import org.apache.guacamole.io.GuacamoleReader;
+import org.apache.guacamole.io.GuacamoleWriter;
+import org.apache.guacamole.net.GuacamoleSocket;
+import org.apache.guacamole.net.GuacamoleTunnel;
+import org.apache.guacamole.net.InetGuacamoleSocket;
+import org.apache.guacamole.net.SSLGuacamoleSocket;
+import org.apache.guacamole.net.SimpleGuacamoleTunnel;
+import org.apache.guacamole.net.auth.GuacamoleProxyConfiguration;
+import org.apache.guacamole.protocol.ConfiguredGuacamoleSocket;
+import org.apache.guacamole.protocol.GuacamoleClientInformation;
+import org.apache.guacamole.protocol.GuacamoleConfiguration;
+import org.apache.guacamole.token.TokenFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Service which provides a centralized means of establishing connections,
+ * tracking/joining active connections, and retrieving associated data.
+ */
+@Singleton
+public class ConnectionService {
+
+    /**
+     * Logger for this class.
+     */
+    private static final Logger logger = 
LoggerFactory.getLogger(ConnectionService.class);
+
+    /**
+     * The Guacamole server environment.
+     */
+    @Inject
+    private Environment environment;
+
+    /**
+     * Mapping of the unique IDs of active connections (as specified within the
+     * UserData.Connection object) to the underlying connection ID (as returned
+     * via the Guacamole protocol handshake). Only connections with defined IDs
+     * are tracked here.
+     */
+    private final ConcurrentHashMap<String, String> activeConnections =

Review Comment:
   Why does this extension have its own internal tracking of connections? The 
ticket and PR description describe this extension to be for allowing an 
external service to control whether a user can log in or not, which shouldn't 
require any of this.
   
   Most of the code here looks like it was just copied from the 
guacamole-auth-json `ConnectionService` class. If all this functionality is 
indeed needed here, maybe it could be moved to a shared class in 
`guacamole-ext` that both extensions can use, rather than just duplicating it 
here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to