Skip to content

Commit

Permalink
some fixes and updated spring version to 3.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
CriMDev97 committed Nov 9, 2023
1 parent 356f64f commit d154169
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 74 deletions.
117 changes: 59 additions & 58 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<version>3.1.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>it.pagopa.interop</groupId>
Expand All @@ -17,16 +17,10 @@
<java.version>17</java.version>
<jacoco.min.line.cover.ratio>0.00</jacoco.min.line.cover.ratio>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hibernate.version>5.6.15.Final</hibernate.version>
<com.amazonaws.version>2.11.0</com.amazonaws.version>
<io.springfox.version>2.8.0</io.springfox.version>
<org.openapitools.version>0.2.1</org.openapitools.version>
<javax.xml.bind.version>2.3.1</javax.xml.bind.version>
<org.projectlombok.version>1.18.24</org.projectlombok.version>
<org.projectlombok.mapstruct.version>0.2.0
</org.projectlombok.mapstruct.version>
<org.projectlombok.mapstruct.version>0.2.0</org.projectlombok.mapstruct.version>
<org.mapstruct.version>1.5.1.Final</org.mapstruct.version>
<com.fasterxml.jackson.dataformat.version>2.13.4</com.fasterxml.jackson.dataformat.version>
</properties>
<dependencyManagement>
<dependencies>
Expand All @@ -51,16 +45,6 @@
<artifactId>aws-xray-recorder-sdk-spring</artifactId>
<version>${com.amazonaws.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${javax.xml.bind.version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>${org.openapitools.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
Expand Down Expand Up @@ -90,16 +74,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-reactor-netty</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${io.springfox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${io.springfox.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down Expand Up @@ -132,28 +106,18 @@
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>jwks-rsa</artifactId>
<version>0.22.1</version>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
Expand All @@ -170,25 +134,65 @@
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<version>0.8.11.RELEASE</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-starter-sqs</artifactId>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.0.0-rc2</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>kms</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sts</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>jwks-rsa</artifactId>
<version>0.22.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>


<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!--LOCALSTACK/TESTCONTAINERS-->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>localstack</artifactId>
Expand All @@ -209,7 +213,6 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<configuration>

<excludes>
<exclude>it/pagopa/interop/signalhub/pull/service/rest/v1/dto/*</exclude>
<exclude>it/pagopa/interop/signalhub/pull/service/rest/v1/dto/**</exclude>
Expand All @@ -218,12 +221,9 @@
<exclude>it/pagopa/interop/signalhub/pull/service/generated/*</exclude>
<exclude>it/pagopa/interop/signalhub/pull/service/generated/**</exclude>
</excludes>

</configuration>
<executions>
<execution>
<id>prepare-integration-tests</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
Expand Down Expand Up @@ -266,7 +266,7 @@
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.6.0</version>
<version>7.0.1</version>
<executions>
<execution>
<id>generate-platform-internal-api</id>
Expand All @@ -282,6 +282,7 @@
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<useSpringBoot3>true</useSpringBoot3>
<dateLibrary>java11</dateLibrary>
<delegatePattern>true</delegatePattern>
<interfaceOnly>true</interfaceOnly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.JWTVerificationException;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.common.net.HttpHeaders;
import it.pagopa.interop.signalhub.pull.service.exception.JWTException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ public class SecurityWebFluxConfig {
@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http, JWTFilter jwtFilter) {

http.csrf().disable();

http.authorizeExchange()
.pathMatchers("/actuator/health/**")
.permitAll()
.and()
.addFilterAt(jwtFilter, SecurityWebFiltersOrder.FIRST)
.authorizeExchange()
.anyExchange()
.authenticated();
http.csrf(ServerHttpSecurity.CsrfSpec::disable);

http.authorizeExchange(authReq -> {
authReq.pathMatchers("/actuator/health/**").permitAll();
authReq.anyExchange().authenticated();
});

http.addFilterAt(jwtFilter, SecurityWebFiltersOrder.FIRST);

return http.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;

import javax.validation.constraints.NotNull;
import java.security.PublicKey;
import java.util.function.Function;

Expand All @@ -51,7 +50,7 @@ public class JWTFilter implements WebFilter {
private JWTRepository jwtRepository;

@Override
public Mono<Void> filter(ServerWebExchange exchangeRequest, @NotNull WebFilterChain chain) {
public Mono<Void> filter(ServerWebExchange exchangeRequest, WebFilterChain chain) {
if (exchangeRequest.getRequest().getHeaders().get("Authorization") == null) {
return chain.filter(exchangeRequest);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package it.pagopa.interop.signalhub.pull.service.service.impl;

import it.pagopa.interop.signalhub.pull.service.entities.EService;
import it.pagopa.interop.signalhub.pull.service.exception.ExceptionTypeEnum;
import it.pagopa.interop.signalhub.pull.service.exception.PDNDGenericException;
import it.pagopa.interop.signalhub.pull.service.mapper.SignalMapper;
Expand Down Expand Up @@ -35,7 +34,7 @@ public Flux<Signal> pullSignal(String consumerId, String eServiceId, Long indexS
return consumerEserviceRepository.findByConsumerIdAndEServiceId(eServiceId, consumerId)
.switchIfEmpty(Mono.error(new PDNDGenericException(ExceptionTypeEnum.CORRESPONDENCE_NOT_FOUND, ExceptionTypeEnum.CORRESPONDENCE_NOT_FOUND.getMessage().concat(eServiceId), HttpStatus.FORBIDDEN)))
.flatMap(consumerEService -> eServiceRepository.checkEServiceStatus(eServiceId, consumerEService.getDescriptorId()))
.doOnNext(eService -> log.info("Faccio una ricerca tra {} - {}", start, end))
.doOnNext(eService -> log.info("Searching signals from {} to {}", start, end))
.flatMapMany(eservice -> signalRepository.findSignal(eServiceId, start, end))
.map(signalMapper::toDto);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@


class SignalControllerTest extends BaseTest.WithWebEnvironment {

@Autowired
private WebTestClient webTestClient;
@MockBean
Expand Down

0 comments on commit d154169

Please sign in to comment.