jtuglu1 commented on code in PR #19236:
URL: https://github.com/apache/druid/pull/19236#discussion_r3052732419


##########
processing/src/main/java/org/apache/druid/auth/TaskAuthContext.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.druid.auth;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import org.apache.druid.guice.annotations.ExtensionPoint;
+
+import javax.annotation.Nullable;
+import java.util.Map;
+
+/**
+ * Holds authentication context that can be passed to tasks for accessing 
external services
+ * that require user credentials (e.g., Iceberg REST Catalog with OAuth).
+ *
+ * <p>Implementations must ensure credentials are redacted during 
serialization by applying
+ * {@link TaskAuthContextRedactionMixIn} to the ObjectMapper used for 
persistence/logging.
+ * This follows the same pattern as {@link 
org.apache.druid.metadata.PasswordProvider} and
+ * {@link org.apache.druid.metadata.PasswordProviderRedactionMixIn}.
+ *
+ * <p>The auth context is injected into tasks at submission time by {@code 
TaskAuthContextProvider}
+ * and is available during task execution. It is NOT persisted to metadata 
storage - only the
+ * non-sensitive fields (identity, metadata) are serialized.
+ *
+ * <p><b>Credential lifetime:</b> Vended credentials (OAuth tokens, STS 
session tokens) have
+ * limited lifetimes, typically 1-12 hours. There is currently no credential 
refresh mechanism,
+ * so long-running tasks may fail when credentials expire. Task restarts are 
also not supported

Review Comment:
   I was going to add this in a separate change. Using a task auth context, 
inputSource could conceivably just use that with some implementable revend() 
method. The only issue I would want to avoid is having the subtasks refresh the 
credentials (and not the driver task), since this might cause thundering herd 
effect where many subtasks all attempt to refresh at once. Spark does a better 
job of this by letting executor handle credential refresh on the driver, then 
propagate that to the executors.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to