Skip to content

Commit 2a68423

Browse files
authored
[AMORO-3873][FOLLOWUP] Rename rest auth bearer type to JWT (#3953)
1 parent 6a73691 commit 2a68423

File tree

4 files changed

+17
-20
lines changed

4 files changed

+17
-20
lines changed

amoro-ams/src/main/java/org/apache/amoro/server/AmoroManagementConf.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,7 @@ public class AmoroManagementConf {
275275
ConfigOptions.key("http-server.rest-auth-type")
276276
.stringType()
277277
.defaultValue("token")
278-
.withDescription(
279-
"The authentication used by REST APIs, token (default), basic or bearer.");
278+
.withDescription("The authentication used by REST APIs, token (default), basic or jwt.");
280279

281280
public static final ConfigOption<Duration> HTTP_SERVER_SESSION_TIMEOUT =
282281
ConfigOptions.key("http-server.session-timeout")
@@ -292,12 +291,12 @@ public class AmoroManagementConf {
292291
"User-defined password authentication implementation of"
293292
+ " org.apache.amoro.authentication.PasswdAuthenticationProvider");
294293

295-
public static final ConfigOption<String> HTTP_SERVER_AUTH_BEARER_PROVIDER =
296-
ConfigOptions.key("http-server.auth-bearer-provider")
294+
public static final ConfigOption<String> HTTP_SERVER_AUTH_JWT_PROVIDER =
295+
ConfigOptions.key("http-server.auth-jwt-provider")
297296
.stringType()
298297
.noDefaultValue()
299298
.withDescription(
300-
"User-defined Bearer token such as JWT (JSON Web Token) authentication implementation"
299+
"User-defined JWT (JSON Web Token) authentication implementation"
301300
+ " of org.apache.amoro.authentication.TokenAuthenticationProvider");
302301

303302
public static final ConfigOption<String> HTTP_SERVER_PROXY_CLIENT_IP_HEADER =

amoro-ams/src/main/java/org/apache/amoro/server/dashboard/DashboardServer.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class DashboardServer {
7474
public static final Logger LOG = LoggerFactory.getLogger(DashboardServer.class);
7575

7676
private static final String AUTH_TYPE_BASIC = "basic";
77-
private static final String AUTH_TYPE_BEARER = "bearer";
77+
private static final String AUTH_TYPE_JWT = "jwt";
7878
private static final String X_REQUEST_SOURCE_HEADER = "X-Request-Source";
7979
private static final String X_REQUEST_SOURCE_WEB = "Web";
8080
private final CatalogController catalogController;
@@ -91,7 +91,7 @@ public class DashboardServer {
9191
private final ApiTokenController apiTokenController;
9292

9393
private final PasswdAuthenticationProvider basicAuthProvider;
94-
private final TokenAuthenticationProvider bearerAuthProvider;
94+
private final TokenAuthenticationProvider jwtAuthProvider;
9595
private final String proxyClientIpHeader;
9696

9797
public DashboardServer(
@@ -126,11 +126,10 @@ public DashboardServer(
126126
serviceConfig.get(AmoroManagementConf.HTTP_SERVER_AUTH_BASIC_PROVIDER),
127127
serviceConfig)
128128
: null;
129-
this.bearerAuthProvider =
130-
AUTH_TYPE_BEARER.equalsIgnoreCase(authType)
129+
this.jwtAuthProvider =
130+
AUTH_TYPE_JWT.equalsIgnoreCase(authType)
131131
? HttpAuthenticationFactory.getBearerAuthenticationProvider(
132-
serviceConfig.get(AmoroManagementConf.HTTP_SERVER_AUTH_BEARER_PROVIDER),
133-
serviceConfig)
132+
serviceConfig.get(AmoroManagementConf.HTTP_SERVER_AUTH_JWT_PROVIDER), serviceConfig)
134133
: null;
135134
this.proxyClientIpHeader =
136135
serviceConfig.get(AmoroManagementConf.HTTP_SERVER_PROXY_CLIENT_IP_HEADER);
@@ -410,15 +409,15 @@ public void preHandleRequest(Context ctx) {
410409
}
411410
return;
412411
}
413-
if (null != basicAuthProvider || null != bearerAuthProvider) {
412+
if (null != basicAuthProvider || null != jwtAuthProvider) {
414413
Principal authPrincipal;
415414
if (null != basicAuthProvider) {
416415
authPrincipal =
417416
basicAuthProvider.authenticate(
418417
HttpAuthenticationFactory.getPasswordCredential(ctx, proxyClientIpHeader));
419418
} else {
420419
authPrincipal =
421-
bearerAuthProvider.authenticate(
420+
jwtAuthProvider.authenticate(
422421
HttpAuthenticationFactory.getBearerTokenCredential(ctx, proxyClientIpHeader));
423422
}
424423
LOG.info(

amoro-common/src/main/java/org/apache/amoro/authentication/TokenAuthenticationProvider.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@
2424

2525
public interface TokenAuthenticationProvider {
2626
/**
27-
* TokenAuthenticationProvider is used by the Amoro server authentication layer to validate Bearer
28-
* tokens, such as JWT (JSON Web Token), provided in client requests. If the token is invalid,
29-
* expired, or fails signature verification, a {@link SignatureCheckException} should be thrown to
30-
* deny access.
27+
* TokenAuthenticationProvider is used by the Amoro server authentication layer to validate JSON
28+
* Web Token (JWT) provided in client requests. If the token is invalid, expired, or fails
29+
* signature verification, a {@link SignatureCheckException} should be thrown to deny access.
3130
*
32-
* @param credential The Bearer token credential (e.g., JWT) received in the connection request
31+
* @param credential The JSON Web Token credential received in the connection request
3332
* @return The {@link Principal} associated with the authenticated token
3433
* @throws SignatureCheckException If the token is invalid, expired, or fails verification
3534
*/

docs/admin-guides/deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ If you want to use AMS in a production environment, it is recommended to modify
7575
- The `ams.thrift-server.table-service.bind-port` configuration specifies the binding port of the Thrift Server that provides the table service. The compute engines access AMS through this port, and the default value is 1260.
7676
- The `ams.thrift-server.optimizing-service.bind-port` configuration specifies the binding port of the Thrift Server that provides the optimizing service. The optimizers access AMS through this port, and the default value is 1261.
7777
- The `ams.http-server.bind-port` configuration specifies the port to which the HTTP service is bound. The Dashboard and Open API are bound to this port, and the default value is 1630.
78-
- The `ams.http-server.rest-auth-type` configuration specifies the REST API auth type, which could be token(default), basic or bearer.
78+
- The `ams.http-server.rest-auth-type` configuration specifies the REST API auth type, which could be token(default), basic or jwt (JSON Web Token).
7979
- The `ams.http-server.auth-basic-provider` configuration specifies the REST API basic authentication provider. By default, it uses `ams.admin-username` and `ams.admin-password` for authentication. You can also specify a custom implementation by providing the fully qualified class name of a class that implements the `org.apache.amoro.authentication.PasswdAuthenticationProvider` interface.
80-
- The `ams.http-server.auth-bearer-provider` configuration specifies the REST API Bearer token authentication provider. Set this to the fully qualified class name of your custom provider implementing the `org.apache.amoro.authentication.TokenAuthenticationProvider` interface. This is required when `ams.http-server.rest-auth-type` is set to `bearer`.
80+
- The `ams.http-server.auth-jwt-provider` configuration specifies the REST API JWT authentication provider. Set this to the fully qualified class name of your custom provider implementing the `org.apache.amoro.authentication.TokenAuthenticationProvider` interface. This is required when `ams.http-server.rest-auth-type` is set to `jwt`.
8181
- The `ams.http-server.proxy-client-ip-header` configuration specifies the HTTP header to use for extracting the real client IP address when AMS is deployed behind a reverse proxy (such as Nginx or a load balancer). Common values include `X-Forwarded-For` or `X-Real-IP`. If not set, AMS will use the remote address from the connection.
8282

8383
```yaml

0 commit comments

Comments
 (0)