From 58cbdd19f303f8a66c341eef23fdd69a3a09f336 Mon Sep 17 00:00:00 2001 From: C4tWithShell Date: Thu, 15 Feb 2024 23:55:19 +0300 Subject: [PATCH] Update time --- .../github/v3/RestApplicationAuthenticationProvider.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v3/RestApplicationAuthenticationProvider.java b/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v3/RestApplicationAuthenticationProvider.java index ecf5530..7d7875c 100644 --- a/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v3/RestApplicationAuthenticationProvider.java +++ b/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v3/RestApplicationAuthenticationProvider.java @@ -78,7 +78,9 @@ public RepositoryAuthenticationToken getInstallationToken(String apiUrl, String Instant issued = clock.instant().minus(10, ChronoUnit.SECONDS); Instant expiry = issued.plus(2, ChronoUnit.MINUTES); - String jwtToken = Jwts.builder().setIssuedAt(Date.from(issued)).setExpiration(Date.from(expiry)) + Date createdDate = new Date(); + Date expirationDate = new Date(createdDate.getTime() + 120 * 1000); + String jwtToken = Jwts.builder().setIssuedAt(createdDate).setExpiration(expirationDate) .claim("iss", appId).signWith(createPrivateKey(apiPrivateKey), SignatureAlgorithm.RS256).compact(); Optional repositoryAuthenticationToken = findTokenFromAppInstallationList(getV3Url(apiUrl) + "/app/installations", jwtToken, projectPath);