Compare commits
78 Commits
d35063519e
...
renovate/o
| Author | SHA1 | Date | |
|---|---|---|---|
| eca1645b2b | |||
| 6596c248f1 | |||
| f1bbaab518 | |||
| e66b387863 | |||
| 4915d26e5d | |||
| 658f98289d | |||
| e987e91ee4 | |||
| 55b2ccd176 | |||
| c3a7a11de7 | |||
| 1a52cd01d9 | |||
| ea1f3f3154 | |||
| a278b41123 | |||
| 2a7d6db45c | |||
| c319ef42bd | |||
| b1ec39bf28 | |||
| 246a8c322f | |||
| 59d83cea15 | |||
| dd38eb2c8b | |||
| 9c00f85df3 | |||
| d0b2daba1e | |||
| cb77527ac9 | |||
| 045e22eb7e | |||
| df5f23d029 | |||
| 6125ba7328 | |||
| 7646cd5206 | |||
| c55d3e702a | |||
| 3cb1d47d31 | |||
| b0757787d1 | |||
| c690d224c9 | |||
| ef22d2f671 | |||
| 508190863a | |||
| deaa0400d4 | |||
| 38d77faf68 | |||
| 2f8ea9a8a6 | |||
| 4aab871d3f | |||
| 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 | |||
| 2c3c2b783e | |||
| c5c76c77fa | |||
| 992e57a46b | |||
| 638bdd9b7b |
10
.drone.yml
10
.drone.yml
@@ -8,6 +8,10 @@ trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
branch:
|
||||
include:
|
||||
- main
|
||||
- develop
|
||||
|
||||
steps:
|
||||
# test if it compiles correctly
|
||||
@@ -24,6 +28,9 @@ steps:
|
||||
|
||||
# check maven dependencies
|
||||
- name: dependency-check
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
image: maven:3-eclipse-temurin-21
|
||||
commands:
|
||||
- mvn dependency-check:check --no-transfer-progress -B -V -DnvdApiKey=$NVD_API_KEY
|
||||
@@ -33,6 +40,9 @@ steps:
|
||||
|
||||
# run code analysis
|
||||
- name: code-analysis
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
image: maven:3-eclipse-temurin-21
|
||||
commands:
|
||||
- mvn sonar:sonar --no-transfer-progress -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.token=$SONAR_LOGIN_KEY -B -V
|
||||
|
||||
24
pom.xml
24
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.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.23.1</version>
|
||||
<version>2.25.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Web Dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.5.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.5.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.5.11</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.11</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.3</version>
|
||||
<version>42.7.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<plugin>
|
||||
<groupId>org.owasp</groupId>
|
||||
<artifactId>dependency-check-maven</artifactId>
|
||||
<version>12.1.0</version>
|
||||
<version>12.2.0</version>
|
||||
<configuration>
|
||||
<failBuildOnCVSS>8</failBuildOnCVSS>
|
||||
<nvdApiKey>${nvdApiKey}</nvdApiKey>
|
||||
@@ -109,4 +109,4 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
@@ -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