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


##########
extensions/guacamole-auth-nextcloud/src/main/java/org/apache/guacamole/auth/nextcloud/user/UserDataService.java:
##########
@@ -0,0 +1,370 @@
+/*
+ * 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.user;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.auth.nextcloud.ConfigurationService;
+import org.apache.guacamole.auth.nextcloud.RequestValidationService;
+import org.apache.guacamole.net.auth.Connection;
+import org.apache.guacamole.net.auth.Credentials;
+import org.apache.guacamole.net.auth.Directory;
+import org.apache.guacamole.net.auth.User;
+import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
+import org.apache.guacamole.net.auth.simple.SimpleDirectory;
+import org.apache.guacamole.net.auth.simple.SimpleObjectPermissionSet;
+import org.apache.guacamole.net.auth.simple.SimpleUser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Service for deriving Guacamole extension API data from UserData objects.
+ */
+@Singleton
+public class UserDataService {
+
+    /**
+     * Logger for this class.
+     */
+    private static final Logger logger = 
LoggerFactory.getLogger(UserDataService.class);
+
+    /**
+     * ObjectMapper for deserializing UserData objects.
+     */
+    private static final ObjectMapper mapper = new ObjectMapper();
+
+    /**
+     * Denylist of single-use user data objects which have already been used.
+     */
+    private final UserDataDenylist denylist = new UserDataDenylist();
+
+    /**
+     * Service for retrieving configuration information regarding the
+     * NextcloudJwtAuthenticationProvider.
+     */
+    @Inject
+    private ConfigurationService confService;
+
+    /**
+     * Service for testing the validity of HTTP requests.
+     */
+    @Inject
+    private RequestValidationService requestService;
+
+    /**
+     * Service for handling cryptography-related operations.
+     */
+//    @Inject
+//    private CryptoService cryptoService;
+
+    /**
+     * Provider for UserDataConnection instances.
+     */
+    @Inject
+    private Provider<UserDataConnection> userDataConnectionProvider;
+
+    /**
+     * The name of the HTTP parameter from which base64-encoded, encrypted JSON
+     * data should be read. The value of this parameter, when decoded and
+     * decrypted, must be valid JSON prepended with the 32-byte raw binary
+     * signature generated through signing the JSON with the secret key using
+     * HMAC/SHA-256.
+     */
+    public static final String ENCRYPTED_DATA_PARAMETER = "data";
+
+    /**
+     * Derives a new UserData object from the data contained within the given
+     * Credentials. If no such data is present, or the data present is invalid,
+     * null is returned.
+     *
+     * @param credentials
+     *     The Credentials from which the new UserData object should be
+     *     derived.
+     *
+     * @return
+     *     A new UserData object derived from the data contained within the
+     *     given Credentials, or null if no such data is present or if the data
+     *     present is invalid.
+     */
+    public UserData fromCredentials(Credentials credentials) {
+
+//        String json;
+//        byte[] correctSignature;

Review Comment:
   Oh, thanks for pointing that out. It has been removed.



-- 
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