anmolanmol1234 commented on code in PR #7901:
URL: https://github.com/apache/hadoop/pull/7901#discussion_r2344054829


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/oauth2/WorkloadIdentityTokenProvider.java:
##########
@@ -38,11 +38,72 @@ public class WorkloadIdentityTokenProvider extends 
AccessTokenProvider {
   private static final String EMPTY_TOKEN_FILE_ERROR = "Empty token file found 
at specified path: ";
   private static final String TOKEN_FILE_READ_ERROR = "Error reading token 
file at specified path: ";
 
+  /**
+   * Internal implementation of ClientAssertionProvider for file-based token 
reading.
+   * This provides backward compatibility for the file-based constructor.
+   */
+  private static class FileBasedClientAssertionProvider implements 
ClientAssertionProvider {
+    private final String tokenFile;
+
+    public FileBasedClientAssertionProvider(String tokenFile) {
+      this.tokenFile = tokenFile;
+    }
+
+    @Override
+    public void initialize(Configuration configuration, String accountName) 
throws IOException {
+      // No initialization needed for file-based provider
+    }
+
+    @Override
+    public String getClientAssertion() throws IOException {
+      String clientAssertion = "";
+      try {
+        File file = new File(tokenFile);
+        clientAssertion = FileUtils.readFileToString(file, "UTF-8");

Review Comment:
   Here we are reading the whole token file as a string every time 
getClientAssertion() is called. If file is large or accessed frequently, it 
could be inefficient. Can we cache the value until the token provider 
explicitly refreshes ?



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to