Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade jjwt to 0.12.6 #807

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
<properties>
<jackson.version>2.14.0</jackson.version>
<javadoc.plugin.version>3.3.1</javadoc.plugin.version>
<jjwt.version>0.11.2</jjwt.version>
<jjwt.version>0.12.6</jjwt.version>
<skip.tests>false</skip.tests>
<dependency.skip>false</dependency.skip>
<sonar.organization>twilio</sonar.organization>
Expand Down Expand Up @@ -491,4 +491,4 @@
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
</project>
</project>
14 changes: 7 additions & 7 deletions src/test/java/com/twilio/jwt/accesstoken/AccessTokenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ private void validateToken(Claims claims) {
}

private Claims getClaimFromJwtToken(Jwt token) {
return Jwts.parserBuilder()
.setSigningKey(SECRET.getBytes()).build()
.parseClaimsJws(token.toJwt())
return Jwts.parser()
.setSigningKey(SECRET.getBytes()).build()
.parseSignedClaims(token.toJwt())
.getBody();
}

Expand Down Expand Up @@ -100,9 +100,9 @@ public void testRegion() {
.region("foo")
.build();

JwsHeader header = Jwts.parserBuilder()
JwsHeader header = Jwts.parser()
.setSigningKey(SECRET.getBytes()).build()
.parseClaimsJws(token.toJwt())
.parseSignedClaims(token.toJwt())
.getHeader();

Assert.assertEquals("foo", header.get("twr"));
Expand All @@ -112,9 +112,9 @@ public void testRegion() {
public void testEmptyRegion() {
Jwt token = new AccessToken.Builder(ACCOUNT_SID, SIGNING_KEY_SID, SECRET).build();

JwsHeader header = Jwts.parserBuilder()
JwsHeader header = Jwts.parser()
.setSigningKey(SECRET.getBytes()).build()
.parseClaimsJws(token.toJwt())
.parseSignedClaims(token.toJwt())
.getHeader();

Assert.assertEquals(null, header.get("twr"));
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/com/twilio/jwt/client/ClientCapabilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.junit.Assert;
import org.junit.Test;

import javax.crypto.spec.SecretKeySpec;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
Expand All @@ -23,9 +24,9 @@ public void testEmptyToken() {
Jwt jwt = new ClientCapability.Builder(ACCOUNT_SID, SECRET).build();

Claims claims =
Jwts.parserBuilder()
Jwts.parser()
.setSigningKey(SECRET.getBytes()).build()
.parseClaimsJws(jwt.toJwt())
.parseSignedClaims(jwt.toJwt())
.getBody();

Assert.assertEquals(ACCOUNT_SID, claims.getIssuer());
Expand All @@ -43,8 +44,8 @@ public void testToken() {

Claims claims =
Jwts.parser()
.setSigningKey(SECRET.getBytes())
.parseClaimsJws(jwt.toJwt())
.setSigningKey(SECRET.getBytes()).build()
.parseSignedClaims(jwt.toJwt())
.getBody();

Assert.assertEquals(ACCOUNT_SID, claims.getIssuer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public void testToken() {
.policies(policies)
.build();
Claims claims =
Jwts.parserBuilder()
Jwts.parser()
.setSigningKey(AUTH_TOKEN.getBytes()).build()
.parseClaimsJws(jwt.toJwt())
.parseSignedClaims(jwt.toJwt())
.getBody();

Assert.assertEquals(WORKSPACE_SID, claims.get("workspace_sid"));
Expand Down Expand Up @@ -78,9 +78,9 @@ public void testWorkerToken() {
.policies(policies)
.build();
final Claims claims =
Jwts.parserBuilder()
Jwts.parser()
.setSigningKey(AUTH_TOKEN.getBytes()).build()
.parseClaimsJws(jwt.toJwt())
.parseSignedClaims(jwt.toJwt())
.getBody();

Assert.assertEquals(WORKSPACE_SID, claims.get("workspace_sid"));
Expand Down
26 changes: 13 additions & 13 deletions src/test/java/com/twilio/jwt/validation/ValidationTokenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public void testTokenBuilder() {
.build();

Claims claims =
Jwts.parserBuilder()
Jwts.parser()
.setSigningKey(privateKey).build()
.parseClaimsJws(jwt.toJwt())
.parseSignedClaims(jwt.toJwt())
.getBody();

this.validateToken(claims);
Expand All @@ -113,8 +113,8 @@ public void testTokenValidAlgorithms() {
.build();

Claims claims =
Jwts.parserBuilder().setSigningKey(publicKey).build()
.parseClaimsJws(jwt.toJwt())
Jwts.parser().setSigningKey(publicKey).build()
.parseSignedClaims(jwt.toJwt())
.getBody();
validateToken(claims);
}
Expand All @@ -135,8 +135,8 @@ public void testTokenInvalidAlgorithms() {
.build();


Jwts.parserBuilder().setSigningKey(publicKey).build()
.parseClaimsJws(jwt.toJwt())
Jwts.parser().setSigningKey(publicKey).build()
.parseSignedClaims(jwt.toJwt())
.getBody();
}
}
Expand All @@ -151,9 +151,9 @@ public void testTokenFromHttpRequest() throws IOException {

Jwt jwt = ValidationToken.fromHttpRequest(ACCOUNT_SID, CREDENTIAL_SID, SIGNING_KEY_SID, privateKey, request, SIGNED_HEADERS);
Claims claims =
Jwts.parserBuilder().setSigningKey(privateKey).build()
.parseClaimsJws(jwt.toJwt())
.getBody();
Jwts.parser().setSigningKey(privateKey).build()
.parseSignedClaims(jwt.toJwt())
.getBody();

this.validateToken(claims);
Assert.assertEquals("authorization;host", claims.get("hrh"));
Expand All @@ -172,9 +172,9 @@ public void testTokenFromEntityRequest() throws IOException {

Jwt jwt = ValidationToken.fromHttpRequest(ACCOUNT_SID, CREDENTIAL_SID, SIGNING_KEY_SID, privateKey, requestWithEntity, SIGNED_HEADERS);
Claims claims =
Jwts.parserBuilder()
Jwts.parser()
.setSigningKey(privateKey).build()
.parseClaimsJws(jwt.toJwt())
.parseSignedClaims(jwt.toJwt())
.getBody();

this.validateToken(claims);
Expand All @@ -193,9 +193,9 @@ public void testTokenFromHttpRequestWithHostPort() throws IOException {

Jwt jwt = ValidationToken.fromHttpRequest(ACCOUNT_SID, CREDENTIAL_SID, SIGNING_KEY_SID, privateKey, request, SIGNED_HEADERS);
Claims claims =
Jwts.parserBuilder()
Jwts.parser()
.setSigningKey(privateKey).build()
.parseClaimsJws(jwt.toJwt())
.parseSignedClaims(jwt.toJwt())
.getBody();


Expand Down
Loading