Skip to content

Commit 541bf49

Browse files
authored
Update LiveTranscodeDemo.java
1 parent 24346ce commit 541bf49

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/main/java/com/qcloud/cos/demo/ci/LiveTranscodeDemo.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,20 @@ public static String generateToken(String appId, String bucketId, String objectK
5050
}
5151

5252
Algorithm algorithm = Algorithm.HMAC256(secret);
53-
JWTCreator.Builder builder = JWT.create().withIssuer("client").withIssuedAt(Date.from(now)).withExpiresAt(Date.from(expire)).withClaim("Type", "CosCiToken").withClaim("AppId", appId).withClaim("BucketId", bucketId).withClaim("Object", encodedObjectKey).withClaim("Issuer", "client").withClaim("IssuedTimeStamp", now.getEpochSecond()).withClaim("ExpireTimeStamp", expire.getEpochSecond()).withClaim("UsageLimit", 20).withClaim("ProtectSchema", "rsa1024")
54-
// .withClaim("PublicKey", "xxx")
55-
.withClaim("ProtectContentKey", 0);
53+
JWTCreator.Builder builder = JWT.create().withIssuer("client")
54+
.withIssuedAt(Date.from(now))
55+
.withExpiresAt(Date.from(expire))
56+
.withClaim("Type", "CosCiToken")
57+
.withClaim("AppId", appId)
58+
.withClaim("BucketId", bucketId)
59+
.withClaim("Object", encodedObjectKey)
60+
.withClaim("Issuer", "client")
61+
.withClaim("IssuedTimeStamp", now.getEpochSecond())
62+
.withClaim("ExpireTimeStamp", expire.getEpochSecond())
63+
.withClaim("UsageLimit", 20)
64+
.withClaim("ProtectSchema", "rsa1024")
65+
// .withClaim("PublicKey", "xxx")
66+
.withClaim("ProtectContentKey", 0);
5667
return builder.sign(algorithm);
5768
}
5869

0 commit comments

Comments
 (0)