Skip to content

Commit

Permalink
Adopt code to newer version of jjwt.
Browse files Browse the repository at this point in the history
Fixes: #1724
  • Loading branch information
ihrigb committed Oct 16, 2023
1 parent 1cb9e66 commit 4eec659
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<jacoco.coverage.target.class.method>0.50</jacoco.coverage.target.class.method>
<!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. -->
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
<jjwt.suite.version>0.11.5</jjwt.suite.version>
<jjwt.suite.version>0.12.3</jjwt.suite.version>

<jacoco.surefire.argLine />
<surefire.argLine />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.jackson.io.JacksonSerializer;
import org.kohsuke.github.authorization.AuthorizationProvider;

Expand Down Expand Up @@ -173,16 +172,16 @@ private String refreshJWT() {

// Let's set the JWT Claims
JwtBuilder builder = Jwts.builder()
.setIssuedAt(Date.from(issuedAt))
.setExpiration(Date.from(expiration))
.setIssuer(this.applicationId)
.signWith(privateKey, SignatureAlgorithm.RS256);
.issuedAt(Date.from(issuedAt))
.expiration(Date.from(expiration))
.issuer(this.applicationId)
.signWith(privateKey, Jwts.SIG.RS256);

// Token will refresh 2 minutes before it expires
validUntil = expiration.minus(Duration.ofMinutes(2));

// Builds the JWT and serializes it to a compact, URL-safe string
return builder.serializeToJsonWith(new JacksonSerializer<>()).compact();
return builder.json(new JacksonSerializer<>()).compact();
}

Instant getIssuedAt(Instant now) {
Expand Down

0 comments on commit 4eec659

Please sign in to comment.