World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[7538] feat(OAuth) : Adding configs for Azure OAuth login (#7727)
Bharath Krishna00215111b232
diff --git a/common/src/main/java/org/apache/gravitino/auth/ProviderType.java b/common/src/main/java/org/apache/gravitino/auth/ProviderType.javanew file mode 100644index 0000000000..3ff869165e--- /dev/null+++ b/common/src/main/java/org/apache/gravitino/auth/ProviderType.java@@ -0,0 +1,28 @@+/*+ * 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.gravitino.auth;++/** The type of OAuth provider. */+public enum ProviderType {+ /** Default provider. */+ DEFAULT,+ /** Azure AD provider. */+ AZURE+}diff --git a/dev/charts/gravitino/resources/config/gravitino.conf b/dev/charts/gravitino/resources/config/gravitino.confindex 2dcb17057f..ef98b8802c 100644--- a/dev/charts/gravitino/resources/config/gravitino.conf+++ b/dev/charts/gravitino/resources/config/gravitino.conf@@ -69,6 +69,17 @@ gravitino.authenticator.oauth.defaultSignKey = {{ .Values.authenticator.oauth.degravitino.authenticator.oauth.serverUri = {{ .Values.authenticator.oauth.serverUri }}gravitino.authenticator.oauth.tokenPath = {{ .Values.authenticator.oauth.tokenPath }}+gravitino.authenticator.oauth.provider = {{ .Values.authenticator.oauth.provider }}+# Generic OAuth provider configs+{{- if .Values.authenticator.oauth.provider }}+gravitino.authenticator.oauth.client-id = {{ .Values.authenticator.oauth.clientId }}+gravitino.authenticator.oauth.authority = {{ .Values.authenticator.oauth.authority }}+gravitino.authenticator.oauth.scope = {{ .Values.authenticator.oauth.scope }}+{{- if .Values.authenticator.oauth.jwksUri }}+gravitino.authenticator.oauth.jwks-uri = {{ .Values.authenticator.oauth.jwksUri }}+{{- end }}+{{- end }}+# THE CONFIGURATION FOR AUXILIARY SERVICEgravitino.auxService.names = {{ .Values.auxService.names | default "iceberg-rest" }}gravitino.iceberg-rest.classpath = {{ .Values.icebergRest.classpath | default "iceberg-rest-server/libs, iceberg-rest-server/conf" }}diff --git a/server-common/src/main/java/org/apache/gravitino/server/authentication/OAuthConfig.java b/server-common/src/main/java/org/apache/gravitino/server/authentication/OAuthConfig.javaindex 95dac96c47..e9731f7080 100644--- a/server-common/src/main/java/org/apache/gravitino/server/authentication/OAuthConfig.java+++ b/server-common/src/main/java/org/apache/gravitino/server/authentication/OAuthConfig.java@@ -73,4 +73,40 @@ public interface OAuthConfig {.stringConf().checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG).create();++ // OAuth provider configs+ ConfigEntry<String> PROVIDER =+ new ConfigBuilder(OAUTH_CONFIG_PREFIX + "provider")+ .doc("The OAuth provider to use (e.g., azure)")+ .version(ConfigConstants.VERSION_1_0_0)+ .stringConf()+ .create();++ ConfigEntry<String> CLIENT_ID =+ new ConfigBuilder(OAUTH_CONFIG_PREFIX + "client-id")+ .doc("OAuth client ID used for Web UI authentication")+ .version(ConfigConstants.VERSION_1_0_0)+ .stringConf()+ .create();++ ConfigEntry<String> AUTHORITY =+ new ConfigBuilder(OAUTH_CONFIG_PREFIX + "authority")+ .doc("OAuth authority URL (authorization server)")+ .version(ConfigConstants.VERSION_1_0_0)+ .stringConf()+ .create();++ ConfigEntry<String> SCOPE =+ new ConfigBuilder(OAUTH_CONFIG_PREFIX + "scope")+ .doc("OAuth scopes (space-separated)")+ .version(ConfigConstants.VERSION_1_0_0)+ .stringConf()+ .create();++ ConfigEntry<String> JWKS_URI =+ new ConfigBuilder(OAUTH_CONFIG_PREFIX + "jwks-uri")+ .doc("JWKS URI for token validation")+ .version(ConfigConstants.VERSION_1_0_0)+ .stringConf()+ .create();}diff --git a/server/src/main/java/org/apache/gravitino/server/web/ConfigServlet.java b/server/src/main/java/org/apache/gravitino/server/web/ConfigServlet.javaindex 933aec3ad9..a1f8d84698 100644--- a/server/src/main/java/org/apache/gravitino/server/web/ConfigServlet.java+++ b/server/src/main/java/org/apache/gravitino/server/web/ConfigServlet.java@@ -40,7 +40,13 @@ public class ConfigServlet extends HttpServlet {private static final Logger LOG = LoggerFactory.getLogger(ConfigServlet.class);private static final ImmutableSet<ConfigEntry<?>> oauthConfigEntries =- ImmutableSet.of(OAuthConfig.DEFAULT_SERVER_URI, OAuthConfig.DEFAULT_TOKEN_PATH);+ ImmutableSet.of(+ OAuthConfig.DEFAULT_SERVER_URI,+ OAuthConfig.DEFAULT_TOKEN_PATH,+ OAuthConfig.PROVIDER,+ OAuthConfig.CLIENT_ID,+ OAuthConfig.AUTHORITY,+ OAuthConfig.SCOPE);private static final ImmutableSet<ConfigEntry<?>> basicConfigEntries =ImmutableSet.of(Configs.AUTHENTICATORS, Configs.ENABLE_AUTHORIZATION);