You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by ad...@apache.org on 2024/12/11 13:30:40 UTC

(polaris) branch main updated: Remove OAuth2ApiService (#529)

This is an automated email from the ASF dual-hosted git repository.

adutra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 23626290 Remove OAuth2ApiService (#529)
23626290 is described below

commit 23626290b88d827eb006866dbf4367e7baea488a
Author: Alexandre Dutra <ad...@users.noreply.github.com>
AuthorDate: Wed Dec 11 14:30:36 2024 +0100

    Remove OAuth2ApiService (#529)
    
    This intermediary interface became useless as it is now possible to extend / inject its direct parent interface, `IcebergRestOAuth2ApiService`.
---
 .../config/PolarisApplicationConfig.java           |  7 +++---
 .../service/auth/DefaultOAuth2ApiService.java      |  8 +++----
 .../polaris/service/auth/TestOAuth2ApiService.java |  4 ++--
 .../polaris/service/config/OAuth2ApiService.java   | 25 ----------------------
 4 files changed, 9 insertions(+), 35 deletions(-)

diff --git a/dropwizard/service/src/main/java/org/apache/polaris/service/dropwizard/config/PolarisApplicationConfig.java b/dropwizard/service/src/main/java/org/apache/polaris/service/dropwizard/config/PolarisApplicationConfig.java
index 763f6aeb..dd9b8d0a 100644
--- a/dropwizard/service/src/main/java/org/apache/polaris/service/dropwizard/config/PolarisApplicationConfig.java
+++ b/dropwizard/service/src/main/java/org/apache/polaris/service/dropwizard/config/PolarisApplicationConfig.java
@@ -48,7 +48,6 @@ import org.apache.polaris.service.auth.TokenResponse;
 import org.apache.polaris.service.catalog.api.IcebergRestOAuth2ApiService;
 import org.apache.polaris.service.catalog.io.FileIOFactory;
 import org.apache.polaris.service.config.DefaultConfigurationStore;
-import org.apache.polaris.service.config.OAuth2ApiService;
 import org.apache.polaris.service.config.TaskHandlerConfiguration;
 import org.apache.polaris.service.context.CallContextResolver;
 import org.apache.polaris.service.context.RealmContextResolver;
@@ -286,15 +285,15 @@ public class PolarisApplicationConfig extends Configuration {
     this.callContextResolver = callContextResolver;
   }
 
-  private OAuth2ApiService oauth2Service;
+  private IcebergRestOAuth2ApiService oauth2Service;
 
   @JsonProperty("oauth2")
   @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
-  public void setOauth2Service(OAuth2ApiService oauth2Service) {
+  public void setOauth2Service(IcebergRestOAuth2ApiService oauth2Service) {
     this.oauth2Service = oauth2Service;
   }
 
-  private OAuth2ApiService getOauth2Service() {
+  private IcebergRestOAuth2ApiService getOauth2Service() {
     return oauth2Service;
   }
 
diff --git a/service/common/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java b/service/common/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java
index 2b32aba0..6cb202da 100644
--- a/service/common/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java
+++ b/service/common/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java
@@ -29,17 +29,17 @@ import org.apache.hadoop.hdfs.web.oauth2.OAuth2Constants;
 import org.apache.iceberg.rest.auth.OAuth2Properties;
 import org.apache.iceberg.rest.responses.OAuthTokenResponse;
 import org.apache.polaris.core.context.CallContext;
-import org.apache.polaris.service.config.OAuth2ApiService;
+import org.apache.polaris.service.catalog.api.IcebergRestOAuth2ApiService;
 import org.apache.polaris.service.types.TokenType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Default implementation of the {@link OAuth2ApiService} that generates a JWT token for the client
- * if the client secret matches.
+ * Default implementation of the {@link IcebergRestOAuth2ApiService} that generates a JWT token for
+ * the client if the client secret matches.
  */
 @Identifier("default")
-public class DefaultOAuth2ApiService implements OAuth2ApiService {
+public class DefaultOAuth2ApiService implements IcebergRestOAuth2ApiService {
   private static final Logger LOGGER = LoggerFactory.getLogger(DefaultOAuth2ApiService.class);
 
   @Inject private TokenBrokerFactory tokenBrokerFactory;
diff --git a/service/common/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java b/service/common/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java
index ffcdc6a9..d0479362 100644
--- a/service/common/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java
+++ b/service/common/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java
@@ -33,13 +33,13 @@ import org.apache.polaris.core.entity.PolarisEntitySubType;
 import org.apache.polaris.core.entity.PolarisEntityType;
 import org.apache.polaris.core.persistence.MetaStoreManagerFactory;
 import org.apache.polaris.core.persistence.PolarisMetaStoreManager;
-import org.apache.polaris.service.config.OAuth2ApiService;
+import org.apache.polaris.service.catalog.api.IcebergRestOAuth2ApiService;
 import org.apache.polaris.service.types.TokenType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Identifier("test")
-public class TestOAuth2ApiService implements OAuth2ApiService {
+public class TestOAuth2ApiService implements IcebergRestOAuth2ApiService {
   private static final Logger LOGGER = LoggerFactory.getLogger(TestOAuth2ApiService.class);
 
   @Inject private MetaStoreManagerFactory metaStoreManagerFactory;
diff --git a/service/common/src/main/java/org/apache/polaris/service/config/OAuth2ApiService.java b/service/common/src/main/java/org/apache/polaris/service/config/OAuth2ApiService.java
deleted file mode 100644
index 0ab006d8..00000000
--- a/service/common/src/main/java/org/apache/polaris/service/config/OAuth2ApiService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.polaris.service.config;
-
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import org.apache.polaris.service.catalog.api.IcebergRestOAuth2ApiService;
-
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
-public interface OAuth2ApiService extends IcebergRestOAuth2ApiService {}