danhuawang opened a new issue, #11443:
URL: https://github.com/apache/gravitino/issues/11443
### What would you like to be improved?
The Spark connector currently supports only `simple`, `oauth2`, and
`kerberos` authentication types when connecting to the Gravitino server.
However, the built-in IDP requires HTTP Basic Authentication
(username/password), which is not wired up in the Spark connector layer.
The underlying Java client already has `withBasicAuth(username, password)`
and `BasicTokenProvider` implemented, but
`GravitinoDriverPlugin.createGravitinoClient()` throws
`UnsupportedOperationException` for any auth type other than the three
mentioned above. This prevents Spark users from leveraging the built-in IDP
with Basic auth.
### How should we improve?
. Add a `basic` auth type constant and helper method in `AuthProperties`:
```java
public static final String BASIC_AUTH_TYPE = "basic";
public static boolean isBasic(String authType) {
return BASIC_AUTH_TYPE.equalsIgnoreCase(authType);
}
```
2. Add username/password configuration properties in `GravitinoSparkConfig`:
```java
public static final String GRAVITINO_BASIC_USERNAME = GRAVITINO_PREFIX +
"basic.username";
public static final String GRAVITINO_BASIC_PASSWORD = GRAVITINO_PREFIX +
"basic.password";
```
3. Add a `basic` auth branch in
`GravitinoDriverPlugin.createGravitinoClient()`:
```java
} else if (AuthProperties.isBasic(authType)) {
String username = getRequiredConfig(sparkConf,
GravitinoSparkConfig.GRAVITINO_BASIC_USERNAME);
String password = getRequiredConfig(sparkConf,
GravitinoSparkConfig.GRAVITINO_BASIC_PASSWORD);
builder.withBasicAuth(username, password);
}
```
4. Update the Spark connector authentication documentation
(`docs/spark-connector/spark-authentication-with-gravitino.md`) to include the
new Basic auth mode and its configuration properties.
Usage example:
```properties
spark.sql.gravitino.authType = basic
spark.sql.gravitino.basic.username = alice
spark.sql.gravitino.basic.password = Passw0rd-For-Alice1
```
--
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]