Skip to content

Commit

Permalink
feat: upgrade to java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
tkuzynow committed Apr 2, 2024
1 parent b0bc424 commit 012ea80
Show file tree
Hide file tree
Showing 21 changed files with 164 additions and 501 deletions.
50 changes: 21 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
<!-- force at least version 2.16 due to https://logging.apache.org/log4j/2.x/security.html -->
<log4j.version>2.19.0</log4j.version>
<openapi-generator-maven-plugin.version>6.6.0</openapi-generator-maven-plugin.version>
<springfox-boot-starter.version>3.0.0</springfox-boot-starter.version>

<jackson-databind-nullable.version>0.2.3</jackson-databind-nullable.version>
<spring-swagger-ui.version>2.10.0</spring-swagger-ui.version>
<spring-security-core.version>6.0.5</spring-security-core.version>

<spring-security.version>6.0.5</spring-security.version>
<ehcache.version>2.10.9.2</ehcache.version>
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
<java-jwt.version>3.12.1</java-jwt.version>
Expand All @@ -38,10 +38,10 @@
<h2.version>2.1.214</h2.version>
<liquibase-core.version>4.9.1</liquibase-core.version>
<hibernate.validator.version>8.0.0.Final</hibernate.validator.version>
<liquibase.maven.plugin.version>4.1.1</liquibase.maven.plugin.version>
<liquibase.maven.plugin.version>4.23.2</liquibase.maven.plugin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<springfox.boot.starter.version>3.0.0</springfox.boot.starter.version>

</properties>

<dependencies>
Expand Down Expand Up @@ -83,6 +83,11 @@
<artifactId>spring-security-core</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>


<!-- caching dependencies -->
<dependency>
Expand Down Expand Up @@ -125,21 +130,19 @@
<artifactId>plexus-utils</artifactId>
<version>3.3.0</version>
</dependency>
<!-- SpringFox: generate YAML file from POJOs and generate documentation -->


<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.15</version>
</dependency>
<!-- SpringFox: generate YAML file from POJOs and generate documentation -->

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${springfox.boot.starter.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
<version>2.1.15</version>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.4.0</version>
</dependency>

<!-- json dependencies -->
Expand All @@ -149,12 +152,6 @@
<version>20220320</version>
</dependency>

<!-- SpringFox: generate YAML file from POJOs and generate documentation -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${springfox-boot-starter.version}</version>
</dependency>
<!-- Keycloak dependencies -->
<dependency>
<groupId>org.keycloak</groupId>
Expand Down Expand Up @@ -250,19 +247,14 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<version>${spring-security.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>powermock-module-junit4</artifactId>
<groupId>org.powermock</groupId>
<scope>test</scope>
<version>2.0.2</version>
</dependency>
<dependency>
<artifactId>powermock-api-mockito2</artifactId>
<groupId>org.powermock</groupId>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<version>2.0.2</version>
</dependency>
<!-- EasyRandom -->
<dependency>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class VideoController implements VideocallsApi {
*/
@Override
public ResponseEntity<VideoCallResponseDTO> createVideoCall(
@RequestHeader String rcUserId, @Valid CreateVideoCallDTO createVideoCallDto) {
@RequestHeader String rcUserId, CreateVideoCallDTO createVideoCallDto) {
var response = videoCallFacade.startVideoCall(createVideoCallDto, rcUserId);

return new ResponseEntity<>(response, HttpStatus.CREATED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Component
public class UuidRegistry {

private static final List<UUID> GENERATED_UUIDS = new CopyOnWriteArrayList<>();
protected static final List<UUID> GENERATED_UUIDS = new CopyOnWriteArrayList<>();

/**
* Generates an unique {@link UUID} string that is currently not registered and adds it to the
Expand Down
135 changes: 0 additions & 135 deletions src/main/java/de/caritas/cob/videoservice/config/SpringFoxConfig.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package de.caritas.cob.videoservice.config.security;

import de.caritas.cob.videoservice.api.authorization.Authority.AuthorityValue;
import de.caritas.cob.videoservice.config.SpringFoxConfig;
import de.caritas.cob.videoservice.filter.HttpTenantFilter;
import de.caritas.cob.videoservice.filter.StatelessCsrfFilter;
import jakarta.annotation.Nullable;
Expand Down Expand Up @@ -30,6 +29,22 @@ public class WebSecurityConfig implements WebMvcConfigurer {
private static final String UUID_PATTERN =
"\\b[0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b";

public static final String[] WHITE_LIST =
new String[] {
"/videocalls/docs",
"/videocalls/docs/**",
"/videocalls/event/stop",
"/v2/api-docs",
"/configuration/ui",
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui",
"/swagger-ui/**",
"/webjars/**",
"/actuator/health",
"/actuator/health/**"
};

@Autowired AuthorisationService authorisationService;
@Autowired JwtAuthConverterProperties jwtAuthConverterProperties;

Expand Down Expand Up @@ -69,7 +84,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.requestMatchers(SpringFoxConfig.WHITE_LIST)
.requestMatchers(WHITE_LIST)
.permitAll()
.requestMatchers("/videocalls/new")
.hasAuthority(AuthorityValue.CONSULTANT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;

import de.caritas.cob.videoservice.config.SpringFoxConfig;
import de.caritas.cob.videoservice.config.security.WebSecurityConfig;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.Cookie;
Expand Down Expand Up @@ -74,7 +74,7 @@ public static final class DefaultRequiresCsrfMatcher implements RequestMatcher {
@Override
public boolean matches(HttpServletRequest request) {

if (Arrays.stream(SpringFoxConfig.WHITE_LIST)
if (Arrays.stream(WebSecurityConfig.WHITE_LIST)
.parallel()
.anyMatch(request.getRequestURI().toLowerCase()::contains)) {
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application-testing.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ spring.liquibase.enabled=false
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
spring.datasource.schema=classpath*:database/VideoServiceDatabase.sql,classpath*:database/VideoData.sql
spring.sql.init.schema-locations=classpath*:database/VideoServiceDatabase.sql,classpath*:database/VideoData.sql
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect

spring.jpa.open-in-view=false
spring.jpa.hibernate.ddl-auto=none
spring.data.jpa.repositories.bootstrap-mode=default
Expand Down
9 changes: 8 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,11 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDB103Dialect

spring.datasource.url=jdbc:mariadb://localhost:3306/videoservice
spring.datasource.username=videoservice
spring.datasource.password=
spring.datasource.password=

spring.security.oauth2.resourceserver.jwt.issuer-uri: https://localhost/auth/realms/onlineberatung
spring.security.oauth2.resourceserver.jwt.jwk-set-uri: https://localhost/auth/realms/onlineberatung/protocol/openid-connect/certs
spring.jwt.auth.converter.resource-id: app
spring.jwt.auth.converter.principal-attribute: preferred_username

springdoc.api-docs.enabled=false
Loading

0 comments on commit 012ea80

Please sign in to comment.