ublubu commented on code in PR #2924:
URL: https://github.com/apache/iceberg-rust/pull/2924#discussion_r3677175098


##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -161,6 +151,129 @@ impl RestCatalogBuilder {
         self.config.client = Some(client);
         self
     }
+
+    /// Configures the catalog with a custom request authenticator, in place
+    /// of the `token` / `credential` props.
+    ///
+    /// For bearer-token flows, wrap a `TokenProvider` in 
`BearerTokenAuthenticator`.
+    /// For auth that needs to see the outgoing request (e.g. AWS SigV4),
+    /// implement `RequestAuthenticator` directly.
+    pub fn with_authenticator(mut self, authenticator: Arc<dyn 
RequestAuthenticator>) -> Self {
+        self.config.authenticator = Some(authenticator);
+        self
+    }
+}
+
+/// There are multiple ways to configure the auth mechanism used by the 
catalog client.
+/// On our side, we attempt to enforce that only one mechanism is used (see 
`strict_validate`).
+/// But the catalog server can supply arbitrary overrides, so we must 
implement semantics
+/// for multiple options being specified at once.
+///
+/// Option 0: No auth.
+pub struct AuthenticatorConfig {
+    /// Option 1: Custom request authenticator.
+    pub custom_authenticator: Option<Arc<dyn RequestAuthenticator>>,
+
+    /// Option 2: Default OAuth flow.
+    /// OAuth endpoint.
+    pub token_endpoint: String,
+    /// OAuth credentials.
+    pub credential: Option<(Option<String>, String)>,
+    /// OAuth params.
+    pub extra_oauth_params: HashMap<String, String>,
+
+    /// Option 3: Static auth token.
+    pub token: Option<String>,
+}

Review Comment:
   This is roughly equivalent to #2838's `AuthManager`



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