Compare commits
40 Commits
2c3c2b783e
...
renovate/o
| Author | SHA1 | Date | |
|---|---|---|---|
| dcd656606f | |||
| 2831f03ac1 | |||
| e5ffea3196 | |||
| d0776d7f0b | |||
| 2acafb87eb | |||
| f733b03213 | |||
| 2c3246660e | |||
| d98991c0a0 | |||
| d0f0e72eb2 | |||
| ad675f06f0 | |||
| 90334d15f8 | |||
| 02be0a405e | |||
| 574dd4c093 | |||
| e69462be26 | |||
| 2024c356b0 | |||
| 66233827fd | |||
| 02bd377430 | |||
| a2e69c6a57 | |||
| bbbf34da6e | |||
| e05e523c12 | |||
| 8d6bb14fc1 | |||
| 91415bea5b | |||
| 18ca42a056 | |||
| 8029f2d931 | |||
| d6ffe35d6e | |||
| 8b5ba88d24 | |||
| 86742f1f1a | |||
| 8acc7460a0 | |||
| 656a337501 | |||
| 8eaae7c659 | |||
| 6c077bce27 | |||
| 7a0ee4b438 | |||
| 03ea142db2 | |||
| d285783fe7 | |||
| eced10976b | |||
| eadeb8c518 | |||
| 6ffa22d7b5 | |||
| dacdfd7935 | |||
| a728e376f2 | |||
| 9890086810 |
22
pom.xml
22
pom.xml
@@ -13,58 +13,58 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.23.1</version>
|
||||
<version>2.25.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.23.1</version>
|
||||
<version>2.25.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Web Dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
<version>3.4.4</version>
|
||||
<version>3.5.7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Security and Auth -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
<version>0.11.5</version>
|
||||
<version>0.13.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
<version>0.11.5</version>
|
||||
<version>0.13.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
<version>0.11.5</version>
|
||||
<version>0.13.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Database Dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.7.5</version>
|
||||
<version>42.7.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<plugin>
|
||||
<groupId>org.owasp</groupId>
|
||||
<artifactId>dependency-check-maven</artifactId>
|
||||
<version>12.1.0</version>
|
||||
<version>12.1.9</version>
|
||||
<configuration>
|
||||
<failBuildOnCVSS>8</failBuildOnCVSS>
|
||||
<nvdApiKey>${nvdApiKey}</nvdApiKey>
|
||||
|
||||
@@ -2,14 +2,13 @@ package wtf.beatrice.releasehive.services;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import io.jsonwebtoken.io.Decoders;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wtf.beatrice.releasehive.models.User;
|
||||
|
||||
import java.security.Key;
|
||||
import javax.crypto.SecretKey;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -52,11 +51,11 @@ public class JWTService
|
||||
) {
|
||||
return Jwts
|
||||
.builder()
|
||||
.setClaims(extraClaims)
|
||||
.setSubject(userDetails.getEmail())
|
||||
.setIssuedAt(new Date(System.currentTimeMillis()))
|
||||
.setExpiration(new Date(System.currentTimeMillis() + expiration))
|
||||
.signWith(getSignInKey(), SignatureAlgorithm.HS256)
|
||||
.claims(extraClaims)
|
||||
.subject(userDetails.getEmail())
|
||||
.issuedAt(new Date(System.currentTimeMillis()))
|
||||
.expiration(new Date(System.currentTimeMillis() + expiration))
|
||||
.signWith(getSignInKey(), Jwts.SIG.HS256)
|
||||
.compact();
|
||||
}
|
||||
|
||||
@@ -75,14 +74,14 @@ public class JWTService
|
||||
|
||||
private Claims extractAllClaims(String token) {
|
||||
return Jwts
|
||||
.parserBuilder()
|
||||
.setSigningKey(getSignInKey())
|
||||
.parser()
|
||||
.verifyWith(getSignInKey())
|
||||
.build()
|
||||
.parseClaimsJws(token)
|
||||
.getBody();
|
||||
.parseSignedClaims(token)
|
||||
.getPayload();
|
||||
}
|
||||
|
||||
private Key getSignInKey() {
|
||||
private SecretKey getSignInKey() {
|
||||
byte[] keyBytes = Decoders.BASE64.decode(secretKey);
|
||||
return Keys.hmacShaKeyFor(keyBytes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user