adutra commented on code in PR #15703:
URL: https://github.com/apache/iceberg/pull/15703#discussion_r3170291383


##########
core/src/main/java/org/apache/iceberg/rest/auth/oauth2/OAuth2Config.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.iceberg.rest.auth.oauth2;
+
+import com.nimbusds.oauth2.sdk.GrantType;
+import java.util.Map;
+import org.apache.iceberg.rest.auth.oauth2.config.BasicConfig;
+import org.apache.iceberg.rest.auth.oauth2.config.ConfigValidator;
+import org.apache.iceberg.rest.auth.oauth2.config.ImmutableTokenExchangeConfig;
+import org.apache.iceberg.rest.auth.oauth2.config.ImmutableTokenRefreshConfig;
+import org.apache.iceberg.rest.auth.oauth2.config.TokenExchangeConfig;
+import org.apache.iceberg.rest.auth.oauth2.config.TokenRefreshConfig;
+import org.immutables.value.Value;
+
+/** The configuration for the OAuth2 AuthManager. */
[email protected]
+public interface OAuth2Config {
+
+  String PREFIX = "rest.auth.oauth2.";
+
+  /**
+   * The basic configuration, including token endpoint, grant type, client id 
and client secret.
+   * Required.
+   */
+  BasicConfig basicConfig();

Review Comment:
   The composition may seem superfluous now, but it will start making sense 
later. 
   
   For example, when we'll integrate interactive grants, and maybe JWT client 
auth, we'd have more methods:
   
   ```java
     BasicConfig basicConfig();
   
     @Value.Default
     default TokenRefreshConfig tokenRefreshConfig() { ... }
   
     @Value.Default
     default TokenExchangeConfig tokenExchangeConfig() { ... }
   
     @Value.Default
     default AuthorizationCodeConfig authorizationCodeConfig() { ... }
   
     @Value.Default
     default DeviceCodeConfig deviceCodeConfig() { ... }
   
     @Value.Default
     default JWTClientAuthConfig jwtClientAuthConfig() { ... }
   ```
   
   etc.
   
   OAuth2 is an evolving set of standards, so we should be prepared for that. 
Isolating each OAuth2 feature in its own config class helps keeping the 
configuration tidy.
   
   As for `BasicConfig`: it just felt to me more natural to keep `OAuth2Config` 
as the umbrella configuration class, and delegate actual properties to 
config-section classes.



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