1raghavmahajan commented on code in PR #13741:
URL: https://github.com/apache/iceberg/pull/13741#discussion_r2254357385


##########
core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Manager.java:
##########
@@ -273,33 +273,32 @@ protected OAuth2Util.AuthSession 
newSessionFromTokenResponse(
   }
 
   private static void warnIfDeprecatedTokenEndpointUsed(Map<String, String> 
properties) {
-    if (usesDeprecatedTokenEndpoint(properties)) {
+    if (!properties.containsKey(OAuth2Properties.OAUTH2_SERVER_URI)) {
       String credential = properties.get(OAuth2Properties.CREDENTIAL);
       String initToken = properties.get(OAuth2Properties.TOKEN);
       boolean hasCredential = credential != null && !credential.isEmpty();
       boolean hasInitToken = initToken != null;
       if (hasInitToken || hasCredential) {
         LOG.warn(
             "Iceberg REST client is missing the OAuth2 server URI 
configuration and defaults to {}/{}. "
-                + "This automatic fallback will be removed in a future Iceberg 
release."
+                + "This automatic fallback will be removed in a future Iceberg 
release. "
                 + "It is recommended to configure the OAuth2 endpoint using 
the '{}' property to be prepared. "
                 + "This warning will disappear if the OAuth2 endpoint is 
explicitly configured. "
                 + "See https://github.com/apache/iceberg/issues/10537";,
             RESTUtil.stripTrailingSlash(properties.get(CatalogProperties.URI)),
             ResourcePaths.tokens(),
             OAuth2Properties.OAUTH2_SERVER_URI);
       }
-    }
-  }
-
-  private static boolean usesDeprecatedTokenEndpoint(Map<String, String> 
properties) {
-    if (properties.containsKey(OAuth2Properties.OAUTH2_SERVER_URI)) {
+    } else {
       String oauth2ServerUri = 
properties.get(OAuth2Properties.OAUTH2_SERVER_URI);
-      boolean relativePath = !oauth2ServerUri.startsWith("http");
-      boolean sameHost = 
oauth2ServerUri.startsWith(properties.get(CatalogProperties.URI));
-      return relativePath || sameHost;
+      if (!oauth2ServerUri.startsWith("http") && 
oauth2ServerUri.endsWith(ResourcePaths.tokens())) {

Review Comment:
   I have retained this part, keeping in mind @adutra's intention of warning 
users if they're still using the tokens endpoint. I stand by allowing users to 
specify any `oauth2-server-uri`, but if we have to draw a line, the relative 
path seems less explicit and more likely to indicate that they simply copied 
the default value to get rid of the old warning.



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