Skip to content

Commit eb104b4

Browse files
committed
test 6
1 parent a94f46f commit eb104b4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

frontend/server/src/main/java/org/pytorch/serve/http/TokenAuthorizationHandler.java

+4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ private void checkTokenAuthorization(FullHttpRequest req, String type) throws Mo
105105
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss Z");
106106

107107
// Format Instant to a human-readable time format
108+
Instant result3 = Instant.now();
108109
String formattedTime = result2.atZone(zoneId).format(formatter);
109110

110111
// Print the result
111112
System.out.println("Formatted Time: " + formattedTime);
113+
formattedTime = result3.atZone(zoneId).format(formatter);
114+
// Print the result
115+
System.out.println("Formatted Time 2: " + formattedTime);
112116
// System.out.println("TEST -----" + type + "-----");
113117
// String tokenBearer = req.headers().get("Authorization");
114118
// if (tokenBearer == null) {

plugins/endpoints/src/main/java/org/pytorch/serve/plugins/endpoint/Token.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Token extends ModelServerEndpoint {
3939
private static String inferenceKey;
4040
private static Instant managementExpirationTimeMinutes;
4141
private static Instant inferenceExpirationTimeMinutes;
42-
private static Integer timeToExpirationMinutes = 60;
42+
private static Integer timeToExpirationMinutes = 1440;
4343
private SecureRandom secureRandom = new SecureRandom();
4444
private Base64.Encoder baseEncoder = Base64.getUrlEncoder();
4545

@@ -181,7 +181,7 @@ public String checkTokenAuthorization(FullHttpRequest req, String type) {
181181

182182
if (token.equals(key)) {
183183
if (expiration != null && isTokenExpired(expiration)) {
184-
return token + "-2-" + key; // false;
184+
return token + "-2-" + key + "-4-" + expiration; // false;
185185
}
186186
} else {
187187
return token + "-1-" + key; // false;

0 commit comments

Comments
 (0)