Compare commits
38 Commits
eadeb8c518
...
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 | |||
| dacdfd7935 | |||
| a728e376f2 | |||
| 9890086810 |
22
pom.xml
22
pom.xml
@@ -13,58 +13,58 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>2.23.1</version>
|
<version>2.25.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>2.23.1</version>
|
<version>2.25.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Web Dependencies -->
|
<!-- Web Dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
<version>3.4.3</version>
|
<version>3.5.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-json</artifactId>
|
<artifactId>spring-boot-starter-json</artifactId>
|
||||||
<version>3.4.3</version>
|
<version>3.5.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
<version>3.4.4</version>
|
<version>3.5.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Security and Auth -->
|
<!-- Security and Auth -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
<version>3.4.3</version>
|
<version>3.5.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt-api</artifactId>
|
<artifactId>jjwt-api</artifactId>
|
||||||
<version>0.12.6</version>
|
<version>0.13.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt-impl</artifactId>
|
<artifactId>jjwt-impl</artifactId>
|
||||||
<version>0.11.5</version>
|
<version>0.13.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt-jackson</artifactId>
|
<artifactId>jjwt-jackson</artifactId>
|
||||||
<version>0.11.5</version>
|
<version>0.13.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Database Dependencies -->
|
<!-- Database Dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<version>42.7.5</version>
|
<version>42.7.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.owasp</groupId>
|
<groupId>org.owasp</groupId>
|
||||||
<artifactId>dependency-check-maven</artifactId>
|
<artifactId>dependency-check-maven</artifactId>
|
||||||
<version>12.1.0</version>
|
<version>12.1.9</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<failBuildOnCVSS>8</failBuildOnCVSS>
|
<failBuildOnCVSS>8</failBuildOnCVSS>
|
||||||
<nvdApiKey>${nvdApiKey}</nvdApiKey>
|
<nvdApiKey>${nvdApiKey}</nvdApiKey>
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ package wtf.beatrice.releasehive.services;
|
|||||||
|
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import io.jsonwebtoken.SignatureAlgorithm;
|
|
||||||
import io.jsonwebtoken.io.Decoders;
|
import io.jsonwebtoken.io.Decoders;
|
||||||
import io.jsonwebtoken.security.Keys;
|
import io.jsonwebtoken.security.Keys;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import wtf.beatrice.releasehive.models.User;
|
import wtf.beatrice.releasehive.models.User;
|
||||||
|
|
||||||
import java.security.Key;
|
import javax.crypto.SecretKey;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -52,11 +51,11 @@ public class JWTService
|
|||||||
) {
|
) {
|
||||||
return Jwts
|
return Jwts
|
||||||
.builder()
|
.builder()
|
||||||
.setClaims(extraClaims)
|
.claims(extraClaims)
|
||||||
.setSubject(userDetails.getEmail())
|
.subject(userDetails.getEmail())
|
||||||
.setIssuedAt(new Date(System.currentTimeMillis()))
|
.issuedAt(new Date(System.currentTimeMillis()))
|
||||||
.setExpiration(new Date(System.currentTimeMillis() + expiration))
|
.expiration(new Date(System.currentTimeMillis() + expiration))
|
||||||
.signWith(getSignInKey(), SignatureAlgorithm.HS256)
|
.signWith(getSignInKey(), Jwts.SIG.HS256)
|
||||||
.compact();
|
.compact();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,14 +74,14 @@ public class JWTService
|
|||||||
|
|
||||||
private Claims extractAllClaims(String token) {
|
private Claims extractAllClaims(String token) {
|
||||||
return Jwts
|
return Jwts
|
||||||
.parserBuilder()
|
.parser()
|
||||||
.setSigningKey(getSignInKey())
|
.verifyWith(getSignInKey())
|
||||||
.build()
|
.build()
|
||||||
.parseClaimsJws(token)
|
.parseSignedClaims(token)
|
||||||
.getBody();
|
.getPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Key getSignInKey() {
|
private SecretKey getSignInKey() {
|
||||||
byte[] keyBytes = Decoders.BASE64.decode(secretKey);
|
byte[] keyBytes = Decoders.BASE64.decode(secretKey);
|
||||||
return Keys.hmacShaKeyFor(keyBytes);
|
return Keys.hmacShaKeyFor(keyBytes);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user