You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "gkatzioura (via GitHub)" <gi...@apache.org> on 2025/11/06 08:45:59 UTC

[PR] 1311 [fluss]

gkatzioura opened a new pull request, #1941:
URL: https://github.com/apache/fluss/pull/1941

   <!--
   *Thank you very much for contributing to Fluss - we are happy that you want to help us improve Fluss. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/fluss/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no issue.
   
     - Name the pull request in the format "[component] Title of the pull request", where *[component]* should be replaced by the name of the component being changed. Typically, this corresponds to the component label assigned to the issue (e.g., [kv], [log], [client], [flink]). Skip *[component]* if you are unsure about which is the best component.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes.
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
   
   
   **(The sections below can be removed for hotfixes or typos)**
   -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #1311
   
   Add File System support for Google Cloud Storage.
   
   
   ### Brief change log
   
   <!-- Please describe the changes made in this pull request and explain how they address the issue -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "polyzos (via GitHub)" <gi...@apache.org>.
polyzos commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3595342292

   @gkatzioura, we should make sure it works for all prefixes, like
   https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/filesystems/azure/#azure-blob-storage


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "wuchong (via GitHub)" <gi...@apache.org>.
wuchong commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2725033662


##########
fluss-filesystems/fluss-fs-abfs/pom.xml:
##########
@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.fluss</groupId>
+        <artifactId>fluss-filesystems</artifactId>
+        <version>0.9-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>fluss-fs-abfs</artifactId>
+    <name>Fluss : FileSystems : Azure FS</name>
+
+    <packaging>jar</packaging>
+
+    <properties>
+        <fs.azure.sdk.version>3.3.4</fs.azure.sdk.version>
+        <fs.azure.api.version>1.16.0</fs.azure.api.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.fluss</groupId>
+            <artifactId>fluss-common</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- The Hadoop file system adapter classes (bundled) -->
+        <dependency>
+            <groupId>org.apache.fluss</groupId>
+            <artifactId>fluss-fs-hadoop</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- Hadoop's file system abstraction (bundled) -->
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+            <version>${fs.hadoopshaded.version}</version>

Review Comment:
   We should replace the current dependency with the `fluss-fs-hadoop-shaded` artifact, consistent with how other filesystems are handled. This avoids the need to manually declare a direct dependency on `hadoop-common`, which is difficult to maintain under centralized dependency management and often pulls in unnecessary transitive dependencies.
   
   Moreover, depending directly on `hadoop-common` introduces several third-party libraries licensed under Category B (as defined in https://www.apache.org/legal/resolved.html). Including such dependencies requires us to bundle corresponding license notices in the resource folder, significantly increasing maintenance overhead.
   
   Instead, using the shaded artifact cleanly encapsulates these dependencies. The correct declaration is:
   
   ```xml
   <dependency>
       <groupId>org.apache.fluss</groupId>
       <artifactId>fluss-fs-hadoop-shaded</artifactId>
       <version>${project.version}</version>
   </dependency>
   ```



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/AzureFileSystem.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.fluss.fs.abfs;
+
+import org.apache.fluss.fs.FileSystem;
+import org.apache.fluss.fs.abfs.token.AzureDelegationTokenProvider;
+import org.apache.fluss.fs.hdfs.HadoopFileSystem;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.conf.Configuration;
+
+import java.io.IOException;
+
+/**
+ * Implementation of the Fluss {@link FileSystem} interface for Azure Blob Storage. This class
+ * implements the common behavior implemented directly by Fluss and delegates common calls to an
+ * implementation of Hadoop's filesystem abstraction.
+ */
+public class AzureFileSystem extends HadoopFileSystem {
+
+    private final String scheme;
+    private final Configuration conf;
+
+    private volatile AzureDelegationTokenProvider delegationTokenProvider;
+
+    /**
+     * Wraps the given Hadoop File System object as a Flink File System object. The given Hadoop

Review Comment:
   ```suggestion
        * Wraps the given Hadoop File System object as a Fluss File System object. The given Hadoop
   ```



##########
fluss-test-coverage/pom.xml:
##########
@@ -362,6 +362,7 @@
                                         <exclude>org.apache.fluss.fs.hdfs.HdfsSecurityTokenReceiver</exclude>
                                         <exclude>org.apache.fluss.fs.oss.*</exclude>
                                         <exclude>org.apache.fluss.fs.s3.*</exclude>
+                                        <exclude>org.apache.fluss.fs.abfs.*</exclude>

Review Comment:
   Have you tried to remove this exclusion? It seems you have added many tests that will always run, that should have some test coverages. 



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/WasbFileSystemPlugin.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.fluss.fs.abfs;
+
+/** Simple factory for the Abfs file system, registered for the <tt>wasb://</tt> scheme. */
+public class WasbFileSystemPlugin extends AbfsFileSystemPlugin {

Review Comment:
   The current javadocs are too brief and don't explain what these schemes are or their use cases. Suggested javadocs:
   
   ```java
   /**
    * FileSystem plugin for Azure Blob Storage using the ABFS (Azure Blob File System) driver.
    * Registered for the {@code abfs://} scheme.
    *
    * <p>ABFS is the recommended driver for accessing Azure Data Lake Storage Gen2. 
    * Use this scheme for non-SSL connections to ADLS Gen2 storage accounts.
    *
    * <p>URI format: {@code abfs://<container>@<storage-account>.dfs.core.windows.net/<path>}
    */
   public class AbfsFileSystemPlugin extends AzureFileSystemPlugin
   ```
   
   ```java
   /**
    * FileSystem plugin for Azure Blob Storage using the ABFS driver with SSL/TLS encryption.
    * Registered for the {@code abfss://} scheme.
    *
    * <p>This is the secure (SSL-enabled) variant of ABFS, recommended for production use 
    * with Azure Data Lake Storage Gen2.
    *
    * <p>URI format: {@code abfss://<container>@<storage-account>.dfs.core.windows.net/<path>}
    */
   public class AbfssFileSystemPlugin extends AzureFileSystemPlugin
   ```
   
   ```java
   /**
    * FileSystem plugin for Azure Blob Storage using the WASB (Windows Azure Storage Blob) driver.
    * Registered for the {@code wasb://} scheme.
    *
    * <p>WASB is the legacy driver for accessing Azure Blob Storage. Consider using ABFS 
    * for new deployments as it provides better performance and security features.
    *
    * <p>URI format: {@code wasb://<container>@<storage-account>.blob.core.windows.net/<path>}
    */
   public class WasbFileSystemPlugin extends AzureFileSystemPlugin
   ```
   
   ```java
   /**
    * FileSystem plugin for Azure Blob Storage using the WASB driver with SSL/TLS encryption.
    * Registered for the {@code wasbs://} scheme.
    *
    * <p>This is the secure (SSL-enabled) variant of WASB for legacy Azure Blob Storage access.
    * For new deployments, consider using {@code abfss://} with Azure Data Lake Storage Gen2.
    *
    * <p>URI format: {@code wasbs://<container>@<storage-account>.blob.core.windows.net/<path>}
    */
   public class WasbsFileSystemPlugin extends AzureFileSystemPlugin
   ```
   
   This helps users understand:
   1. What each abbreviation stands for
   2. When to use each scheme
   3. The URI format for configuration
   4. The relationship between legacy (WASB) and modern (ABFS) drivers



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/AbfsFileSystemPlugin.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.fluss.fs.abfs;
+
+import org.apache.fluss.config.ConfigBuilder;
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.fs.FileSystem;
+import org.apache.fluss.fs.FileSystemPlugin;
+import org.apache.fluss.fs.abfs.token.AzureDelegationTokenReceiver;
+
+import org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Objects;
+
+import static org.apache.fluss.fs.abfs.token.AzureDelegationTokenProvider.ACCOUNT_KEY;
+import static org.apache.fluss.fs.abfs.token.AzureDelegationTokenProvider.CLIENT_ID;
+import static org.apache.fluss.fs.abfs.token.AzureDelegationTokenReceiver.PROVIDER_CONFIG_NAME;
+
+/** Simple factory for the Azure File System. */
+public class AbfsFileSystemPlugin implements FileSystemPlugin {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AbfsFileSystemPlugin.class);
+
+    private static final String[] FLUSS_CONFIG_PREFIXES = {"azure.", "fs.azure.", "fs.wasb."};

Review Comment:
   IIUC, these are the configuration options Fluss exposes to users for configuring Azure File System. Since this is the first time we’re making this API public, can we restrict the config prefix to `fs.azure.` only? This aligns with other filesystem implementations and avoids confusion about which prefix users should use.



##########
fluss-filesystems/fluss-fs-abfs/src/main/resources/META-INF/NOTICE:
##########
@@ -0,0 +1,86 @@
+fluss-fs-abfs
+Copyright 2025 The Apache Software Foundation
+
+This project bundles the following dependencies under the Apache Software License 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt).
+
+- com.fasterxml.jackson.core:jackson-annotations:2.15.3
+- com.fasterxml.jackson.core:jackson-core:2.15.3
+- com.fasterxml.jackson.core:jackson-databind:2.15.3
+- com.fasterxml.woodstox:woodstox-core:5.4.0
+- com.google.guava:failureaccess:1.0
+- com.google.guava:guava:27.0-jre
+- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
+- com.google.j2objc:j2objc-annotations:1.1
+- com.microsoft.azure:azure-keyvault-core:1.0.0
+- com.microsoft.azure:azure-storage:7.0.1
+- commons-beanutils:commons-beanutils:1.9.4
+- commons-codec:commons-codec:1.11
+- commons-collections:commons-collections:3.2.2
+- commons-io:commons-io:2.14.0
+- commons-logging:commons-logging:1.2
+- io.dropwizard.metrics:metrics-core:3.2.4
+- io.netty:netty-buffer:4.1.100.Final
+- io.netty:netty-codec:4.1.100.Final
+- io.netty:netty-common:4.1.100.Final
+- io.netty:netty-handler:4.1.100.Final
+- io.netty:netty-resolver:4.1.100.Final
+- io.netty:netty-transport:4.1.100.Final
+- io.netty:netty-transport-classes-epoll:4.1.100.Final
+- io.netty:netty-transport-native-epoll:4.1.100.Final
+- io.netty:netty-transport-native-unix-common:4.1.100.Final
+- org.apache.commons:commons-compress:1.24.0
+- org.apache.commons:commons-configuration2:2.8.0
+- org.apache.commons:commons-lang3:3.18.0
+- org.apache.commons:commons-text:1.10.0
+- org.apache.hadoop.thirdparty:hadoop-shaded-guava:1.2.0
+- org.apache.hadoop.thirdparty:hadoop-shaded-protobuf_3_21:1.2.0
+- org.apache.hadoop:hadoop-annotations:3.4.0
+- org.apache.hadoop:hadoop-auth:3.4.0
+- org.apache.hadoop:hadoop-azure:3.4.0
+- org.apache.hadoop:hadoop-common:3.4.0
+- org.apache.kerby:kerb-core:2.0.3
+- org.apache.kerby:kerby-asn1:2.0.3
+- org.apache.kerby:kerby-pkix:2.0.3
+- org.apache.kerby:kerby-util:2.0.3
+- org.apache.httpcomponents:httpclient:4.5.13
+- org.apache.httpcomponents:httpcore:4.4.13
+- org.codehaus.jettison:jettison:1.5.4
+- org.wildfly.openssl:wildfly-openssl:1.1.3.Final
+- org.xerial.snappy:snappy-java:1.1.10.4
+- javax.xml.stream:stax-api:1.0-2
+
+This project bundles the following dependencies under the BSD license. See bundled license files for details.
+
+- dnsjava:dnsjava:3.4.0
+- org.codehaus.woodstox:stax2-api:4.2.1
+
+This project bundles the following dependencies under the Go License (https://golang.org/LICENSE). See bundled license files for details.
+
+- com.google.re2j:re2j:1.1
+
+This project bundles the following dependencies under dual license CDDL 1.1 / GPLv2 with Classpath Exception.
+- CDDL 1.1: https://oss.oracle.com/licenses/CDDL-1.1
+- GPLv2 + CPE: https://openjdk.org/legal/gplv2+ce.html
+
+- javax.xml.bind:jaxb-api:2.2.2
+- javax.xml.bind:jaxb-api:2.3.1
+- javax.activation:activation:1.1
+- com.sun.xml.bind:jaxb-impl:2.2.3-1
+- com.github.pjfanning:jersey-json:1.20
+
+This project bundles the following dependencies under the Eclipse Distribution License (EDL) 1.0 (https://www.eclipse.org/org/documents/edl-v10.php). See bundled license files for details.
+
+- jakarta.activation:jakarta.activation-api:1.2.1

Review Comment:
   This change introduces many Category B dependencies. According to Apache Software Foundation policy, all Category B dependencies require a corresponding `LICENSE-xxx` notice in the resource folder. These dependencies are likely pulled in because of a direct dependency on `hadoop-common`.
   
   To avoid this, please try replacing the direct `hadoop-common` dependency with `fluss-fs-hadoop-shaded`. This shaded artifact should encapsulate those transitive dependencies and may eliminate the need to declare them explicitly in the `NOTICE` file.



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/AbfsFileSystemPlugin.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.fluss.fs.abfs;
+
+import org.apache.fluss.config.ConfigBuilder;
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.fs.FileSystem;
+import org.apache.fluss.fs.FileSystemPlugin;
+import org.apache.fluss.fs.abfs.token.AzureDelegationTokenReceiver;
+
+import org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Objects;
+
+import static org.apache.fluss.fs.abfs.token.AzureDelegationTokenProvider.ACCOUNT_KEY;
+import static org.apache.fluss.fs.abfs.token.AzureDelegationTokenProvider.CLIENT_ID;
+import static org.apache.fluss.fs.abfs.token.AzureDelegationTokenReceiver.PROVIDER_CONFIG_NAME;
+
+/** Simple factory for the Azure File System. */
+public class AbfsFileSystemPlugin implements FileSystemPlugin {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AbfsFileSystemPlugin.class);
+
+    private static final String[] FLUSS_CONFIG_PREFIXES = {"azure.", "fs.azure.", "fs.wasb."};
+
+    private static final String HADOOP_CONFIG_PREFIX = "fs.azure.";
+
+    @Override
+    public String getScheme() {
+        return "abfs";
+    }
+
+    @Override
+    public FileSystem create(URI fsUri, Configuration flussConfig) throws IOException {
+        org.apache.hadoop.conf.Configuration hadoopConfig = getHadoopConfiguration(flussConfig);
+
+        setCredentialProvider(hadoopConfig);
+
+        // create the Google Hadoop FileSystem

Review Comment:
   ```suggestion
           // create the Azure Hadoop FileSystem
   ```



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenReceiver.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+import org.apache.fluss.fs.token.SecurityTokenReceiver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/** Security token receiver for the abfs filesystem. */
+public class AzureDelegationTokenReceiver implements SecurityTokenReceiver {
+    public static final String PROVIDER_CONFIG_NAME = "fs.azure.account.oauth.provider.type";
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenReceiver.class);
+
+    static volatile Credentials credentials;
+    static volatile Long validUntil;
+    static volatile Map<String, String> additionInfos;
+
+    public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) {
+        LOG.info("Updating Hadoop configuration");
+
+        String providers = hadoopConfig.get(PROVIDER_CONFIG_NAME, "");
+
+        if (!providers.contains(DynamicTemporaryAzureCredentialsProvider.NAME)) {
+            if (providers.isEmpty()) {
+                LOG.debug("Setting provider");
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME;
+            } else {
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME + "," + providers;
+                LOG.debug("Prepending provider, new providers value: {}", providers);
+            }
+            hadoopConfig.set(PROVIDER_CONFIG_NAME, providers);
+        } else {
+            LOG.debug("Provider already exists");
+        }
+
+        // then, set addition info
+        if (additionInfos == null) {
+            // if addition info is null, it also means we have not received any token,
+            // we throw IllegalStateException
+            throw new IllegalStateException(DynamicTemporaryAzureCredentialsProvider.COMPONENT);
+        } else {
+            for (Map.Entry<String, String> entry : additionInfos.entrySet()) {
+                hadoopConfig.set(entry.getKey(), entry.getValue());
+            }
+        }
+
+        LOG.info("Updated Hadoop configuration successfully");
+    }
+
+    @Override
+    public String scheme() {
+        return "abfs";

Review Comment:
   Is this `AzureDelegationTokenReceiver` can only be used for `abfs` or can be shared for all azure filesystems? If it can be shared, we should create `AzureDelegationTokenReceiver` for each azure schemes and register it to SPI. 



##########
fluss-filesystems/fluss-fs-gs/src/test/java/org/apache/fluss/fs/gs/AuthServerHandler.java:
##########
@@ -43,7 +43,7 @@
 import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
 import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.OK;
 
-/** Netty Handler for facilitating the Google auth token generation. */
+/** Netty Handler for facilitating the Azure auth token generation. */
 public class AuthServerHandler extends SimpleChannelInboundHandler<HttpObject> {

Review Comment:
   revert. This is under google fs package



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AuthServerHandler.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.shaded.netty4.io.netty.buffer.Unpooled;
+import org.apache.fluss.shaded.netty4.io.netty.channel.ChannelHandlerContext;
+import org.apache.fluss.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.FullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpMethod;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpObject;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpRequest;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;
+import org.apache.fluss.shaded.netty4.io.netty.util.AsciiString;
+import org.apache.fluss.utils.IOUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_ENCODING;
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_LENGTH;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.APPLICATION_JSON;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.CLOSE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.OK;
+
+/** Netty Handler for facilitating the Google auth token generation. */

Review Comment:
   ```suggestion
   /** Netty Handler for facilitating the Azure auth token generation. */
   ```



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] 1311 [fluss]

Posted by "polyzos (via GitHub)" <gi...@apache.org>.
polyzos commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3496313982

   @gkatzioura, you mean -> Add File System support for Azure Blob Storage? 
   


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2722723928


##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AuthServerHandler.java:
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.shaded.netty4.io.netty.buffer.Unpooled;
+import org.apache.fluss.shaded.netty4.io.netty.channel.ChannelHandlerContext;
+import org.apache.fluss.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.FullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpMethod;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpObject;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpRequest;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;
+import org.apache.fluss.shaded.netty4.io.netty.util.AsciiString;
+import org.apache.fluss.utils.IOUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_ENCODING;
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_LENGTH;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.APPLICATION_JSON;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.CLOSE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.OK;
+
+/** Netty Handler for facilitating the Google auth token generation. */

Review Comment:
   Changed to Azure



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "leekeiabstraction (via GitHub)" <gi...@apache.org>.
leekeiabstraction commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2722558220


##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenReceiver.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+import org.apache.fluss.fs.token.SecurityTokenReceiver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/** Security token receiver for the abfs filesystem. */
+public class AzureDelegationTokenReceiver implements SecurityTokenReceiver {
+    public static final String PROVIDER_CONFIG_NAME = "fs.azure.account.oauth.provider.type";
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenReceiver.class);
+
+    static volatile Credentials credentials;
+    static volatile Map<String, String> additionInfos;
+
+    public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) {
+        LOG.info("Updating Hadoop configuration");
+
+        String providers = hadoopConfig.get(PROVIDER_CONFIG_NAME, "");
+
+        if (!providers.contains(DynamicTemporaryAzureCredentialsProvider.NAME)) {
+            if (providers.isEmpty()) {
+                LOG.debug("Setting provider");
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME;
+            } else {
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME + "," + providers;
+                LOG.debug("Prepending provider, new providers value: {}", providers);
+            }
+            hadoopConfig.set(PROVIDER_CONFIG_NAME, providers);
+        } else {
+            LOG.debug("Provider already exists");
+        }
+
+        // then, set addition info
+        if (additionInfos == null) {
+            // if addition info is null, it also means we have not received any token,
+            // we throw InvalidCredentialsException
+            throw new IllegalStateException(DynamicTemporaryAzureCredentialsProvider.COMPONENT);
+        } else {
+            for (Map.Entry<String, String> entry : additionInfos.entrySet()) {
+                hadoopConfig.set(entry.getKey(), entry.getValue());
+            }
+        }
+
+        LOG.info("Updated Hadoop configuration successfully");
+    }
+
+    @Override
+    public String scheme() {
+        return "abfs";
+    }
+
+    @Override
+    public void onNewTokensObtained(ObtainedSecurityToken token) {
+        LOG.info("Updating session credentials");
+
+        byte[] tokenBytes = token.getToken();
+
+        credentials = CredentialsJsonSerde.fromJson(tokenBytes);
+        additionInfos = token.getAdditionInfos();
+
+        LOG.info(
+                "Session credentials updated successfully with access key: {}.",
+                credentials.getAccessKeyId());

Review Comment:
   This will always show up as null as AzureDelegationTokenProvider instantiates Credentials object with null `accessKeyId`, can we provide a more useful log message?



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenReceiver.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+import org.apache.fluss.fs.token.SecurityTokenReceiver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/** Security token receiver for the abfs filesystem. */
+public class AzureDelegationTokenReceiver implements SecurityTokenReceiver {
+    public static final String PROVIDER_CONFIG_NAME = "fs.azure.account.oauth.provider.type";
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenReceiver.class);
+
+    static volatile Credentials credentials;
+    static volatile Map<String, String> additionInfos;
+
+    public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) {
+        LOG.info("Updating Hadoop configuration");
+
+        String providers = hadoopConfig.get(PROVIDER_CONFIG_NAME, "");
+
+        if (!providers.contains(DynamicTemporaryAzureCredentialsProvider.NAME)) {
+            if (providers.isEmpty()) {
+                LOG.debug("Setting provider");
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME;
+            } else {
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME + "," + providers;
+                LOG.debug("Prepending provider, new providers value: {}", providers);
+            }
+            hadoopConfig.set(PROVIDER_CONFIG_NAME, providers);
+        } else {
+            LOG.debug("Provider already exists");
+        }
+
+        // then, set addition info
+        if (additionInfos == null) {
+            // if addition info is null, it also means we have not received any token,
+            // we throw InvalidCredentialsException
+            throw new IllegalStateException(DynamicTemporaryAzureCredentialsProvider.COMPONENT);

Review Comment:
   Name of exception type doesn't match between actual and comment



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenProviderTest.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.conf.Configuration;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Tests for {@link AzureDelegationTokenProvider}. */
+public class AzureDelegationTokenProviderTest {
+
+    private static final String CONFIG_PREFIX = "fs.azure.account.oauth2.client";
+    private static final String CLIENT_ID = "testClientId";
+    private static final String CLIENT_SECRET = "testClientSecret";
+
+    private static final String ENDPOINT_KEY = "http://localhost:8080";
+
+    private static MockAuthServer mockGSServer;

Review Comment:
   Should this say abfs instead?



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/DynamicTemporaryAzureCredentialsProviderTest.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.fs.azurebfs.contracts.exceptions.TokenAccessProviderException;
+import org.apache.hadoop.fs.azurebfs.oauth2.AzureADToken;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link DynamicTemporaryAzureCredentialsProvider}. */
+class DynamicTemporaryAzureCredentialsProviderTest {
+
+    private static final String CLIENT_ID = "testClientId";
+    private static final String CLIENT_SECRET = "testClientSecret";

Review Comment:
   Let's use null values for these to be consistent with the behaviour of Provider.



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/DynamicTemporaryAzureCredentialsProviderTest.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.fs.azurebfs.contracts.exceptions.TokenAccessProviderException;
+import org.apache.hadoop.fs.azurebfs.oauth2.AzureADToken;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link DynamicTemporaryAzureCredentialsProvider}. */
+class DynamicTemporaryAzureCredentialsProviderTest {
+
+    private static final String CLIENT_ID = "testClientId";
+    private static final String CLIENT_SECRET = "testClientSecret";
+
+    private static final String SESSION_TOKEN = "sessionToken";
+
+    @Test
+    void getCredentialsShouldThrowExceptionWhenNoCredentials() {
+        DynamicTemporaryAzureCredentialsProvider provider =
+                new DynamicTemporaryAzureCredentialsProvider();
+
+        assertThatThrownBy(provider::getToken).isInstanceOf(TokenAccessProviderException.class);
+    }
+
+    @Test
+    void getCredentialsShouldStoreCredentialsWhenCredentialsProvided() throws Exception {
+        DynamicTemporaryAzureCredentialsProvider provider =
+                new DynamicTemporaryAzureCredentialsProvider();
+        Credentials credentials = new Credentials(CLIENT_ID, CLIENT_SECRET, SESSION_TOKEN);
+
+        AzureDelegationTokenReceiver receiver = new AzureDelegationTokenReceiver();
+
+        byte[] json = CredentialsJsonSerde.toJson(credentials);
+
+        ObtainedSecurityToken obtainedSecurityToken =
+                new ObtainedSecurityToken("abfs", json, 1L, new HashMap<>());
+        receiver.onNewTokensObtained(obtainedSecurityToken);
+
+        AzureADToken azureADToken = provider.getToken();
+        assertThat(azureADToken.getAccessToken()).isEqualTo(credentials.getSecurityToken());

Review Comment:
   Let's also assert on `accessKeyId` and `secretAccessKey`



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AuthServerHandler.java:
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.shaded.netty4.io.netty.buffer.Unpooled;
+import org.apache.fluss.shaded.netty4.io.netty.channel.ChannelHandlerContext;
+import org.apache.fluss.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.FullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpMethod;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpObject;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpRequest;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;
+import org.apache.fluss.shaded.netty4.io.netty.util.AsciiString;
+import org.apache.fluss.utils.IOUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_ENCODING;
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_LENGTH;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.APPLICATION_JSON;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.CLOSE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.OK;
+
+/** Netty Handler for facilitating the Google auth token generation. */
+public class AuthServerHandler extends SimpleChannelInboundHandler<HttpObject> {
+
+    @Override
+    public void channelReadComplete(ChannelHandlerContext ctx) {
+        ctx.flush();
+    }
+
+    @Override
+    public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
+        if (msg instanceof HttpRequest) {
+            HttpRequest req = (HttpRequest) msg;
+
+            try {
+                URI url = URI.create(req.uri());
+                if (req.method().equals(HttpMethod.POST)) {
+                    postRequest(ctx, url, req);
+                } else {
+                    getRequest(ctx, url, req);
+                }
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    private void postRequest(ChannelHandlerContext ctx, URI url, HttpRequest req)
+            throws IOException {
+        if (url.getPath().endsWith("/")) {
+            jsonResponse(ctx, req, "create-token.json");
+        } else {
+            response(ctx, req, new byte[] {}, NOT_FOUND, APPLICATION_JSON);
+        }
+    }
+
+    private void getRequest(ChannelHandlerContext ctx, URI url, HttpRequest req)
+            throws IOException {
+        if (url.getPath().endsWith("/token")) {
+            jsonResponse(ctx, req, "create-token.json");
+        } else {
+            response(ctx, req, new byte[] {}, NOT_FOUND, APPLICATION_JSON);
+        }
+    }
+
+    private void jsonResponse(ChannelHandlerContext ctx, HttpRequest req, String path)
+            throws IOException {
+        jsonResponse(ctx, req, path, OK);
+    }
+
+    private void jsonResponse(
+            ChannelHandlerContext ctx,
+            HttpRequest req,
+            String path,
+            HttpResponseStatus responseStatus)
+            throws IOException {
+        response(ctx, req, readFromResources(path), responseStatus, APPLICATION_JSON);
+    }
+
+    private static void response(
+            ChannelHandlerContext ctx,
+            HttpRequest req,
+            byte[] bytes,
+            HttpResponseStatus status,
+            AsciiString contentType) {
+        FullHttpResponse response =
+                new DefaultFullHttpResponse(
+                        req.protocolVersion(), status, Unpooled.wrappedBuffer(bytes));
+        response.headers()
+                .set(CONTENT_TYPE, contentType)
+                .set("Location", "http://localhost:8080/resumbable-upload")

Review Comment:
   Question for my understanding: Why do we need to have this endpoint in test's AuthServerHandler?



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AuthServerHandler.java:
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.shaded.netty4.io.netty.buffer.Unpooled;
+import org.apache.fluss.shaded.netty4.io.netty.channel.ChannelHandlerContext;
+import org.apache.fluss.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.FullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpMethod;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpObject;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpRequest;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;
+import org.apache.fluss.shaded.netty4.io.netty.util.AsciiString;
+import org.apache.fluss.utils.IOUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_ENCODING;
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_LENGTH;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.APPLICATION_JSON;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.CLOSE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.OK;
+
+/** Netty Handler for facilitating the Google auth token generation. */

Review Comment:
   Should this say Azure instead of Google?



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/AbfsFileSystemBehaviorITCase.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.fluss.fs.abfs;
+
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.fs.FileSystem;
+import org.apache.fluss.fs.FileSystemBehaviorTestSuite;
+import org.apache.fluss.fs.FsPath;
+import org.apache.fluss.fs.abfs.token.MockAuthServer;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+
+import java.io.IOException;
+import java.net.URI;
+
+/** Tests that validate the behavior of the Google Cloud Storage File System Plugin. */
+class AbfsFileSystemBehaviorITCase extends FileSystemBehaviorTestSuite {
+
+    private static final String CONFIG_PREFIX = "fs.azure.account";
+    private static final String CLIENT_ID = "testClientId";
+    private static final String CLIENT_SECRET = "testClientSecret";
+
+    private static final String AZURE_ACCOUNT_KEY = "ZmFrZS1rZXkK";
+    private static final String ENDPOINT_KEY = "http://localhost:8080";
+    public static final String ABFS_FS_PATH = "abfs://flus@test.dfs.core.windows.net/test";
+
+    private static MockAuthServer mockGSServer;

Review Comment:
   Should this be named `mockAbfsServer` instead?



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenProviderTest.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.conf.Configuration;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Tests for {@link AzureDelegationTokenProvider}. */
+public class AzureDelegationTokenProviderTest {
+
+    private static final String CONFIG_PREFIX = "fs.azure.account.oauth2.client";
+    private static final String CLIENT_ID = "testClientId";
+    private static final String CLIENT_SECRET = "testClientSecret";
+
+    private static final String ENDPOINT_KEY = "http://localhost:8080";
+
+    private static MockAuthServer mockGSServer;
+
+    @BeforeAll
+    static void setup() {
+        mockGSServer = MockAuthServer.create();
+    }
+
+    @Test
+    void obtainSecurityTokenShouldReturnSecurityToken() {
+        Configuration configuration = new Configuration();
+        configuration.set(CONFIG_PREFIX + ".id", CLIENT_ID);
+        configuration.set(CONFIG_PREFIX + ".secret", CLIENT_SECRET);
+        configuration.set(CONFIG_PREFIX + ".endpoint", ENDPOINT_KEY);
+        AzureDelegationTokenProvider azureDelegationTokenProvider =
+                new AzureDelegationTokenProvider("abfs", configuration);
+        ObtainedSecurityToken obtainedSecurityToken =
+                azureDelegationTokenProvider.obtainSecurityToken();
+        byte[] token = obtainedSecurityToken.getToken();
+        Credentials credentials = CredentialsJsonSerde.fromJson(token);
+        assertThat(credentials.getSecurityToken()).isEqualTo("token");

Review Comment:
   We should also assert on `accessKeyId` and `secretAccessKey`, even if they are expected to be null.



##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenReceiverTest.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.apache.fluss.fs.abfs.token.AzureDelegationTokenReceiver.PROVIDER_CONFIG_NAME;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link AzureDelegationTokenReceiver}. */
+class AzureDelegationTokenReceiverTest {
+
+    private static final String PROVIDER_CLASS_NAME = "TestProvider";
+    private static final String REGION = "testRegion";

Review Comment:
   Let's remove REGION if it is unused.



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "polyzos (via GitHub)" <gi...@apache.org>.
polyzos commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2726700820


##########
fluss-filesystems/fluss-fs-azure/pom.xml:
##########
@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.fluss</groupId>
+        <artifactId>fluss-filesystems</artifactId>
+        <version>0.9-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>fluss-fs-abfs</artifactId>
+    <name>Fluss : FileSystems : Azure FS</name>
+
+    <packaging>jar</packaging>
+
+    <properties>
+        <fs.azure.sdk.version>3.3.4</fs.azure.sdk.version>
+        <fs.azure.api.version>1.16.0</fs.azure.api.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.fluss</groupId>
+            <artifactId>fluss-common</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- The Hadoop file system adapter classes (bundled) -->
+        <dependency>
+            <groupId>org.apache.fluss</groupId>
+            <artifactId>fluss-fs-hadoop</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- Hadoop's file system abstraction (bundled) -->
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+            <version>${fs.hadoopshaded.version}</version>

Review Comment:
   @wuchong it gives missing class exceptions
   ```
   coordinator-server-1  | java.lang.NoClassDefFoundError: org/apache/hadoop/fs/impl/BackReference
   coordinator-server-1  |         at org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem.initialize(AzureBlobFileSystem.java:200) ~[?:?]
   coordinator-server-1  |         at org.apache.fluss.fs.azure.AzureFileSystemPlugin.create(AzureFileSystemPlugin.java:60) ~[?:?]
   coordinator-server-1  |         at org.apache.fluss.fs.azure.AbfsFileSystemPlugin.create(AbfsFileSystemPlugin.java:29) ~[?:?]
   ```
   
   And thus the NOTICE file can't be updated either, I guess... maybe open a follow-up ticket as an improvement and investigate in the future? Unless you have any thoughts on this issue



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3496701048

   Just as https://github.com/apache/fluss/issues/993 , obtainSecurityToken method is required for client to access Azure Blob Storage when read from remote


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3607501778

   > **abfs://** works fine during my tests.
   > 
   > <img alt="Screenshot 2025-12-03 at 11 28 12 AM" width="604" height="814" src="https://private-user-images.githubusercontent.com/23555517/521793425-16d2c145-f1d7-4508-aa9a-a8490f087e29.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjQ3NzcwNzMsIm5iZiI6MTc2NDc3Njc3MywicGF0aCI6Ii8yMzU1NTUxNy81MjE3OTM0MjUtMTZkMmMxNDUtZjFkNy00NTA4LWFhOWEtYTg0OTBmMDg3ZTI5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTEyMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUxMjAzVDE1NDYxM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMxOWJjYTVhZmFlMzBiMzRlODhmODFiZjFkMjk2N2VlYzlmYTA3N2NhZjk2MTU2MzU0MDg1NDFjODM2YzQ5MzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qpfSoKPB7P8Lw1c0gJuhDdr0mlPjnF9nULRPMj_09Ks">
   > I pushed one commit to disable tests, because we can't meet the test coverage here, and I'm figuring out the issue with the license.
   
   Yes forgot to mention that I added the support


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3654554498

   > Hi @luoyuxia some observations on the obtainSecurityToken functionality.
   > 
   > I do receive the tokens when I read fluss data as a client
   > 
   > ```dockerfile
   > try (LogScanner logScanner = table.newScan().createLogScanner()) {
   >             logScanner.subscribeFromBeginning(1);
   >             var record = logScanner.poll(Duration.ofSeconds(10));
   >             record.forEach(r -> _ );
   > }
   > ```
   > 
   > Once log scanner is started the tokens start to be sent. However I could not see the tokens being shared above fluss components (tablet-server coordinator server). Similar to what happens with Flink JobManager tokens delegated to the TaskManager. My assumption was that the token is shared among the fluss components then it is used with a hadoop custom provider type (Depends on the hadoop driver).
   
   Hi, the security token is not shared above fluss components. Currently, it's only used by fluss-client, fluss-client require a token to read from remote directly.


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3499487285

   > Just as #993 , obtainSecurityToken method is required for client to access Azure Blob Storage when read from remote
   
   checking the options


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3634780440

   Hi @luoyuxia
   some observations on the obtainSecurityToken functionality. 
   
   I do receive the tokens when I read fluss data as a client
   
   ```dockerfile
   try (LogScanner logScanner = table.newScan().createLogScanner()) {
               logScanner.subscribeFromBeginning(1);
               var record = logScanner.poll(Duration.ofSeconds(10));
               record.forEach(r -> _ );
   }
   ```
   Once log scanner is started the tokens start to be sent.
   However I could not see the tokens being shared above fluss components (tablet-server coordinator server).
   Similar to what happens with Flink JobManager tokens delegated to the TaskManager.
   My assumption was that the token is shared among the fluss components then it is used with a 
   hadoop custom provider type (Depends on the hadoop driver).
   


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2618607098


##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/AzureFileSystem.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.fluss.fs.abfs;
+
+import org.apache.fluss.fs.FileSystem;
+import org.apache.fluss.fs.abfs.token.AzureDelegationTokenProvider;
+import org.apache.fluss.fs.hdfs.HadoopFileSystem;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.conf.Configuration;
+
+import java.io.IOException;
+
+/**
+ * Implementation of the Fluss {@link FileSystem} interface for Azure Blob Storage. This class
+ * implements the common behavior implemented directly by Fluss and delegates common calls to an
+ * implementation of Hadoop's filesystem abstraction.
+ */
+public class AzureFileSystem extends HadoopFileSystem {
+
+    private final String scheme;
+    private final Configuration conf;
+
+    private AzureDelegationTokenProvider delegationTokenProvider;

Review Comment:
   ```suggestion
       private volatile AzureDelegationTokenProvider delegationTokenProvider;
   ```



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenReceiver.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+import org.apache.fluss.fs.token.SecurityTokenReceiver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/** Security token receiver for the abfs filesystem. */
+public class AzureDelegationTokenReceiver implements SecurityTokenReceiver {
+    public static final String PROVIDER_CONFIG_NAME = "fs.azure.account.oauth.provider.type";
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenReceiver.class);
+
+    static volatile Credentials credentials;
+    static volatile Map<String, String> additionInfos;
+
+    public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) {

Review Comment:
   updateHadoopConfig is never called.



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenReceiver.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+import org.apache.fluss.fs.token.SecurityTokenReceiver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/** Security token receiver for the abfs filesystem. */
+public class AzureDelegationTokenReceiver implements SecurityTokenReceiver {
+    public static final String PROVIDER_CONFIG_NAME = "fs.azure.account.oauth.provider.type";
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenReceiver.class);
+
+    static volatile Credentials credentials;
+    static volatile Map<String, String> additionInfos;
+
+    public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) {

Review Comment:
   You can refer `S3FileSystemPlugin` for where to call this method.
   In `S3FileSystemPlugin`, it will check `ACCESS_KEY_ID` set or not.
   - if set, do no thing. will use provide ak/sk
   - if not set, it means the FileSystemPlugin is initialized in client side, it will need to get security token from Fluss to access s3. Then it'll call `S3DelegationTokenReceiver#updateHadoopConfig` to set the credential provider, whose token is from Fluss via method getSecurityToken



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/DynamicTemporaryAzureCredentialsProvider.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.azurebfs.contracts.exceptions.TokenAccessProviderException;
+import org.apache.hadoop.fs.azurebfs.extensions.CustomTokenProviderAdaptee;
+import org.apache.hadoop.fs.azurebfs.oauth2.AccessTokenProvider;
+import org.apache.hadoop.fs.azurebfs.oauth2.AzureADToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Date;
+
+/**
+ * Support dynamic token for authenticating with Azure. Please note that users may reference this
+ * class name from configuration property fs.azure.account.oauth.provider.type. Therefore, changing
+ * the class name would be a backward-incompatible change. This credential provider must not fail in
+ * creation because that will break a chain of credential providers.
+ */
+public class DynamicTemporaryAzureCredentialsProvider extends AccessTokenProvider
+        implements CustomTokenProviderAdaptee {
+
+    public static final String NAME = DynamicTemporaryAzureCredentialsProvider.class.getName();
+
+    public static final String COMPONENT = "Dynamic session credentials for Fluss";
+
+    private volatile AzureADToken azureADToken;

Review Comment:
   Seems azureADToken is not used?



##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenProvider.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.azurebfs.oauth2.AzureADAuthenticator;
+import org.apache.hadoop.fs.azurebfs.oauth2.AzureADToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+/** Token provider for abfs Hadoop filesystems. */
+public class AzureDelegationTokenProvider {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenProvider.class);
+
+    private static final String CLIENT_ID = "fs.azure.account.oauth2.client.id";
+    private static final String CLIENT_SECRET = "fs.azure.account.oauth2.client.secret";
+
+    private static final String ENDPOINT_KEY = "fs.azure.account.oauth2.client.endpoint";
+
+    private final String scheme;
+    private final String clientId;
+    private final String clientSecret;
+
+    private final String authEndpoint;
+    private final Map<String, String> additionInfos;
+
+    public AzureDelegationTokenProvider(String scheme, Configuration conf) {
+        this.scheme = scheme;
+
+        this.clientId = conf.get(CLIENT_ID);
+        this.clientSecret = conf.get(CLIENT_SECRET);
+        this.authEndpoint = conf.get(ENDPOINT_KEY);
+        this.additionInfos = new HashMap<>();
+
+        for (String key : Arrays.asList(ENDPOINT_KEY)) {

Review Comment:
   ```suggestion
           for (String key : Collections.singleton(ENDPOINT_KEY))
   ```



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "wuchong (via GitHub)" <gi...@apache.org>.
wuchong commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3796187566

   Also, since the branch is far behind `main`, could you please rebase it onto the latest `main` branch? This will make the CI results more reliable.


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2726627247


##########
fluss-filesystems/fluss-fs-azure/src/main/java/org/apache/fluss/fs/azure/token/AzureDelegationTokenReceiver.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+import org.apache.fluss.fs.token.SecurityTokenReceiver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/** Security token receiver for the abfs filesystem. */
+public class AzureDelegationTokenReceiver implements SecurityTokenReceiver {
+    public static final String PROVIDER_CONFIG_NAME = "fs.azure.account.oauth.provider.type";
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenReceiver.class);
+
+    static volatile Credentials credentials;
+    static volatile Long validUntil;
+    static volatile Map<String, String> additionInfos;
+
+    public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) {
+        LOG.info("Updating Hadoop configuration");
+
+        String providers = hadoopConfig.get(PROVIDER_CONFIG_NAME, "");
+
+        if (!providers.contains(DynamicTemporaryAzureCredentialsProvider.NAME)) {
+            if (providers.isEmpty()) {
+                LOG.debug("Setting provider");
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME;
+            } else {
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME + "," + providers;
+                LOG.debug("Prepending provider, new providers value: {}", providers);
+            }
+            hadoopConfig.set(PROVIDER_CONFIG_NAME, providers);
+        } else {
+            LOG.debug("Provider already exists");
+        }
+
+        // then, set addition info
+        if (additionInfos == null) {
+            // if addition info is null, it also means we have not received any token,
+            // we throw IllegalStateException
+            throw new IllegalStateException(DynamicTemporaryAzureCredentialsProvider.COMPONENT);
+        } else {
+            for (Map.Entry<String, String> entry : additionInfos.entrySet()) {
+                hadoopConfig.set(entry.getKey(), entry.getValue());
+            }
+        }
+
+        LOG.info("Updated Hadoop configuration successfully");
+    }
+
+    @Override
+    public String scheme() {
+        return "abfs";

Review Comment:
   Followed the same strategy as with the filesystem plugins, made an abstract class



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "polyzos (via GitHub)" <gi...@apache.org>.
polyzos commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3738636800

   @gkatzioura is there anything else pending 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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3767093676

   @polyzos & @luoyuxia @wuchong fyi this is ready for the release


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2722720584


##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenReceiver.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+import org.apache.fluss.fs.token.SecurityTokenReceiver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/** Security token receiver for the abfs filesystem. */
+public class AzureDelegationTokenReceiver implements SecurityTokenReceiver {
+    public static final String PROVIDER_CONFIG_NAME = "fs.azure.account.oauth.provider.type";
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenReceiver.class);
+
+    static volatile Credentials credentials;
+    static volatile Map<String, String> additionInfos;
+
+    public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) {
+        LOG.info("Updating Hadoop configuration");
+
+        String providers = hadoopConfig.get(PROVIDER_CONFIG_NAME, "");
+
+        if (!providers.contains(DynamicTemporaryAzureCredentialsProvider.NAME)) {
+            if (providers.isEmpty()) {
+                LOG.debug("Setting provider");
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME;
+            } else {
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME + "," + providers;
+                LOG.debug("Prepending provider, new providers value: {}", providers);
+            }
+            hadoopConfig.set(PROVIDER_CONFIG_NAME, providers);
+        } else {
+            LOG.debug("Provider already exists");
+        }
+
+        // then, set addition info
+        if (additionInfos == null) {
+            // if addition info is null, it also means we have not received any token,
+            // we throw InvalidCredentialsException
+            throw new IllegalStateException(DynamicTemporaryAzureCredentialsProvider.COMPONENT);
+        } else {
+            for (Map.Entry<String, String> entry : additionInfos.entrySet()) {
+                hadoopConfig.set(entry.getKey(), entry.getValue());
+            }
+        }
+
+        LOG.info("Updated Hadoop configuration successfully");
+    }
+
+    @Override
+    public String scheme() {
+        return "abfs";
+    }
+
+    @Override
+    public void onNewTokensObtained(ObtainedSecurityToken token) {
+        LOG.info("Updating session credentials");
+
+        byte[] tokenBytes = token.getToken();
+
+        credentials = CredentialsJsonSerde.fromJson(tokenBytes);
+        additionInfos = token.getAdditionInfos();
+
+        LOG.info(
+                "Session credentials updated successfully with access key: {}.",
+                credentials.getAccessKeyId());

Review Comment:
   I changed the message and switched it to debug since only securityToken is sent, thus better not to leak it.



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2647203542


##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/DynamicTemporaryAzureCredentialsProvider.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.azurebfs.contracts.exceptions.TokenAccessProviderException;
+import org.apache.hadoop.fs.azurebfs.extensions.CustomTokenProviderAdaptee;
+import org.apache.hadoop.fs.azurebfs.oauth2.AccessTokenProvider;
+import org.apache.hadoop.fs.azurebfs.oauth2.AzureADToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Date;
+
+/**
+ * Support dynamic token for authenticating with Azure. Please note that users may reference this
+ * class name from configuration property fs.azure.account.oauth.provider.type. Therefore, changing
+ * the class name would be a backward-incompatible change. This credential provider must not fail in
+ * creation because that will break a chain of credential providers.
+ */
+public class DynamicTemporaryAzureCredentialsProvider extends AccessTokenProvider
+        implements CustomTokenProviderAdaptee {
+
+    public static final String NAME = DynamicTemporaryAzureCredentialsProvider.class.getName();
+
+    public static final String COMPONENT = "Dynamic session credentials for Fluss";
+
+    private volatile AzureADToken azureADToken;

Review Comment:
   Removed, it is being handled behind the scenes by `org.apache.hadoop.fs.azurebfs.oauth2.AccessTokenProvider`



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "wuchong (via GitHub)" <gi...@apache.org>.
wuchong merged PR #1941:
URL: https://github.com/apache/fluss/pull/1941


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "polyzos (via GitHub)" <gi...@apache.org>.
polyzos commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3611166884

   LicenseChecker fixed, and I just finished testing with all schemes. Everything works great 💪 🚀 


-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2722781875


##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AuthServerHandler.java:
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.shaded.netty4.io.netty.buffer.Unpooled;
+import org.apache.fluss.shaded.netty4.io.netty.channel.ChannelHandlerContext;
+import org.apache.fluss.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.DefaultFullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.FullHttpResponse;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpMethod;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpObject;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpRequest;
+import org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;
+import org.apache.fluss.shaded.netty4.io.netty.util.AsciiString;
+import org.apache.fluss.utils.IOUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_ENCODING;
+import static org.apache.fluss.shaded.guava32.com.google.common.net.HttpHeaders.CONTENT_LENGTH;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.APPLICATION_JSON;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpHeaderValues.CLOSE;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
+import static org.apache.fluss.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus.OK;
+
+/** Netty Handler for facilitating the Google auth token generation. */
+public class AuthServerHandler extends SimpleChannelInboundHandler<HttpObject> {
+
+    @Override
+    public void channelReadComplete(ChannelHandlerContext ctx) {
+        ctx.flush();
+    }
+
+    @Override
+    public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
+        if (msg instanceof HttpRequest) {
+            HttpRequest req = (HttpRequest) msg;
+
+            try {
+                URI url = URI.create(req.uri());
+                if (req.method().equals(HttpMethod.POST)) {
+                    postRequest(ctx, url, req);
+                } else {
+                    getRequest(ctx, url, req);
+                }
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    private void postRequest(ChannelHandlerContext ctx, URI url, HttpRequest req)
+            throws IOException {
+        if (url.getPath().endsWith("/")) {
+            jsonResponse(ctx, req, "create-token.json");
+        } else {
+            response(ctx, req, new byte[] {}, NOT_FOUND, APPLICATION_JSON);
+        }
+    }
+
+    private void getRequest(ChannelHandlerContext ctx, URI url, HttpRequest req)
+            throws IOException {
+        if (url.getPath().endsWith("/token")) {
+            jsonResponse(ctx, req, "create-token.json");
+        } else {
+            response(ctx, req, new byte[] {}, NOT_FOUND, APPLICATION_JSON);
+        }
+    }
+
+    private void jsonResponse(ChannelHandlerContext ctx, HttpRequest req, String path)
+            throws IOException {
+        jsonResponse(ctx, req, path, OK);
+    }
+
+    private void jsonResponse(
+            ChannelHandlerContext ctx,
+            HttpRequest req,
+            String path,
+            HttpResponseStatus responseStatus)
+            throws IOException {
+        response(ctx, req, readFromResources(path), responseStatus, APPLICATION_JSON);
+    }
+
+    private static void response(
+            ChannelHandlerContext ctx,
+            HttpRequest req,
+            byte[] bytes,
+            HttpResponseStatus status,
+            AsciiString contentType) {
+        FullHttpResponse response =
+                new DefaultFullHttpResponse(
+                        req.protocolVersion(), status, Unpooled.wrappedBuffer(bytes));
+        response.headers()
+                .set(CONTENT_TYPE, contentType)
+                .set("Location", "http://localhost:8080/resumbable-upload")

Review Comment:
   non needed 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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2723357277


##########
fluss-filesystems/fluss-fs-abfs/src/main/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenReceiver.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+import org.apache.fluss.fs.token.SecurityTokenReceiver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/** Security token receiver for the abfs filesystem. */
+public class AzureDelegationTokenReceiver implements SecurityTokenReceiver {
+    public static final String PROVIDER_CONFIG_NAME = "fs.azure.account.oauth.provider.type";
+
+    private static final Logger LOG = LoggerFactory.getLogger(AzureDelegationTokenReceiver.class);
+
+    static volatile Credentials credentials;
+    static volatile Map<String, String> additionInfos;
+
+    public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) {
+        LOG.info("Updating Hadoop configuration");
+
+        String providers = hadoopConfig.get(PROVIDER_CONFIG_NAME, "");
+
+        if (!providers.contains(DynamicTemporaryAzureCredentialsProvider.NAME)) {
+            if (providers.isEmpty()) {
+                LOG.debug("Setting provider");
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME;
+            } else {
+                providers = DynamicTemporaryAzureCredentialsProvider.NAME + "," + providers;
+                LOG.debug("Prepending provider, new providers value: {}", providers);
+            }
+            hadoopConfig.set(PROVIDER_CONFIG_NAME, providers);
+        } else {
+            LOG.debug("Provider already exists");
+        }
+
+        // then, set addition info
+        if (additionInfos == null) {
+            // if addition info is null, it also means we have not received any token,
+            // we throw InvalidCredentialsException
+            throw new IllegalStateException(DynamicTemporaryAzureCredentialsProvider.COMPONENT);

Review Comment:
   changed



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2726695318


##########
fluss-filesystems/fluss-fs-azure/pom.xml:
##########
@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.fluss</groupId>
+        <artifactId>fluss-filesystems</artifactId>
+        <version>0.9-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>fluss-fs-abfs</artifactId>
+    <name>Fluss : FileSystems : Azure FS</name>
+
+    <packaging>jar</packaging>
+
+    <properties>
+        <fs.azure.sdk.version>3.3.4</fs.azure.sdk.version>
+        <fs.azure.api.version>1.16.0</fs.azure.api.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.fluss</groupId>
+            <artifactId>fluss-common</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- The Hadoop file system adapter classes (bundled) -->
+        <dependency>
+            <groupId>org.apache.fluss</groupId>
+            <artifactId>fluss-fs-hadoop</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- Hadoop's file system abstraction (bundled) -->
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+            <version>${fs.hadoopshaded.version}</version>

Review Comment:
   Unfortunately due to missing class issues I had to revert, can follow up on another branch



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2722806566


##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenProviderTest.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.conf.Configuration;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Tests for {@link AzureDelegationTokenProvider}. */
+public class AzureDelegationTokenProviderTest {
+
+    private static final String CONFIG_PREFIX = "fs.azure.account.oauth2.client";
+    private static final String CLIENT_ID = "testClientId";
+    private static final String CLIENT_SECRET = "testClientSecret";
+
+    private static final String ENDPOINT_KEY = "http://localhost:8080";
+
+    private static MockAuthServer mockGSServer;
+
+    @BeforeAll
+    static void setup() {
+        mockGSServer = MockAuthServer.create();
+    }
+
+    @Test
+    void obtainSecurityTokenShouldReturnSecurityToken() {
+        Configuration configuration = new Configuration();
+        configuration.set(CONFIG_PREFIX + ".id", CLIENT_ID);
+        configuration.set(CONFIG_PREFIX + ".secret", CLIENT_SECRET);
+        configuration.set(CONFIG_PREFIX + ".endpoint", ENDPOINT_KEY);
+        AzureDelegationTokenProvider azureDelegationTokenProvider =
+                new AzureDelegationTokenProvider("abfs", configuration);
+        ObtainedSecurityToken obtainedSecurityToken =
+                azureDelegationTokenProvider.obtainSecurityToken();
+        byte[] token = obtainedSecurityToken.getToken();
+        Credentials credentials = CredentialsJsonSerde.fromJson(token);
+        assertThat(credentials.getSecurityToken()).isEqualTo("token");

Review Comment:
   Added, seems like CredentialsJsonSerde maps null to "null", likely something to check on another ticket.



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on code in PR #1941:
URL: https://github.com/apache/fluss/pull/1941#discussion_r2722787976


##########
fluss-filesystems/fluss-fs-abfs/src/test/java/org/apache/fluss/fs/abfs/token/AzureDelegationTokenProviderTest.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.fluss.fs.abfs.token;
+
+import org.apache.fluss.fs.token.Credentials;
+import org.apache.fluss.fs.token.CredentialsJsonSerde;
+import org.apache.fluss.fs.token.ObtainedSecurityToken;
+
+import org.apache.hadoop.conf.Configuration;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Tests for {@link AzureDelegationTokenProvider}. */
+public class AzureDelegationTokenProviderTest {
+
+    private static final String CONFIG_PREFIX = "fs.azure.account.oauth2.client";
+    private static final String CLIENT_ID = "testClientId";
+    private static final String CLIENT_SECRET = "testClientSecret";
+
+    private static final String ENDPOINT_KEY = "http://localhost:8080";
+
+    private static MockAuthServer mockGSServer;

Review Comment:
   Changed to mockAuthServer



-- 
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: issues-unsubscribe@fluss.apache.org

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


Re: [PR] Azure Blob Storage Support 1311 [fluss]

Posted by "gkatzioura (via GitHub)" <gi...@apache.org>.
gkatzioura commented on PR #1941:
URL: https://github.com/apache/fluss/pull/1941#issuecomment-3496581422

   > @gkatzioura, you mean -> Add File System support for Azure Blob Storage?
   
   Fixed


-- 
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: issues-unsubscribe@fluss.apache.org

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