Skip to content

Commit 2547514

Browse files
committed
fix
1 parent 4585c30 commit 2547514

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

paimon-core/src/main/java/org/apache/paimon/rest/auth/DLFToken.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.apache.paimon.rest.auth;
2020

2121
import org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
22+
import org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonIgnore;
2223
import org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
2324
import org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonInclude;
2425
import org.apache.paimon.shade.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
@@ -56,7 +57,7 @@ public class DLFToken {
5657
@Nullable
5758
private final String expiration;
5859

59-
@Nullable private final Long expirationAtMills;
60+
@JsonIgnore @Nullable private final Long expirationAtMills;
6061

6162
@JsonCreator
6263
public DLFToken(

paimon-core/src/test/java/org/apache/paimon/rest/auth/AuthProviderTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
import java.io.File;
3333
import java.io.IOException;
3434
import java.time.LocalDateTime;
35-
import java.time.ZoneOffset;
36-
import java.time.ZonedDateTime;
3735
import java.util.HashMap;
3836
import java.util.Map;
3937
import java.util.UUID;
@@ -379,8 +377,7 @@ public void testDLFAuthProviderAuthHeaderWhenDataIsNotEmpty() throws Exception {
379377

380378
private Pair<File, String> generateTokenAndWriteToFile(String fileName) throws IOException {
381379
File tokenFile = folder.newFile(fileName);
382-
ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC);
383-
String expiration = now.format(TOKEN_DATE_FORMATTER);
380+
String expiration = LocalDateTime.now().format(TOKEN_DATE_FORMATTER);
384381
String secret = UUID.randomUUID().toString();
385382
DLFToken token = new DLFToken("accessKeyId", secret, "securityToken", expiration);
386383
String tokenStr = OBJECT_MAPPER_INSTANCE.writeValueAsString(token);
@@ -392,11 +389,11 @@ private DLFToken generateToken() {
392389
return generateToken(LocalDateTime.now());
393390
}
394391

395-
private DLFToken generateToken(LocalDateTime now) {
392+
private DLFToken generateToken(LocalDateTime expireTime) {
396393
String accessKeyId = UUID.randomUUID().toString();
397394
String accessKeySecret = UUID.randomUUID().toString();
398395
String securityToken = UUID.randomUUID().toString();
399-
String expiration = now.format(TOKEN_DATE_FORMATTER);
396+
String expiration = expireTime.format(TOKEN_DATE_FORMATTER);
400397
return new DLFToken(accessKeyId, accessKeySecret, securityToken, expiration);
401398
}
402399

0 commit comments

Comments
 (0)