From aa11ff3380eeb504ab941017e31a8f06ba79decb Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Thu, 14 Nov 2024 18:34:45 +0100 Subject: [PATCH 01/25] setup worflow to push docker image to ghcr --- .github/workflows/docker-build.yml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..f24e604 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,32 @@ +name: Build and Push Docker Image +on: + # Trigger the workflow only when a pull request is merged into main + pull_request: + branches: + - main + types: + - closed +jobs: + build: + # Run this job only if the pull request is actually merged + if: github.event.pull_request.merged == true + + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker image + run: | + docker build -t ghcr.io/adorsys-gis/webank-online-banking:latest . + + - name: Push Docker image to GHCR + run: | + docker push ghcr.io/adorsys-gis/webank-online-banking:latest \ No newline at end of file From 2ad2c5df8ab4c2076fb50bf83d5ccb8ca9d5f9d2 Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Tue, 19 Nov 2024 17:03:21 +0100 Subject: [PATCH 02/25] configure worflow to push image to ghcr --- .github/workflows/{docker-build.yml => docker-build.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{docker-build.yml => docker-build.yaml} (100%) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yaml similarity index 100% rename from .github/workflows/docker-build.yml rename to .github/workflows/docker-build.yaml From 72bbecfd313afcab02677a921b4a8e17bed0b992 Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Wed, 20 Nov 2024 08:14:50 +0100 Subject: [PATCH 03/25] configure worflow to push image to ghcr --- .github/workflows/docker-build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 8d8a816..4bf08fb 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -3,8 +3,6 @@ on: pull_request: branches: - main - types: - - closed jobs: build: if: github.event.pull_request.merged == true From 8ac6d233ab5bf4ac6591029e1f1c8d445040b8fa Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Fri, 29 Nov 2024 15:33:30 +0100 Subject: [PATCH 04/25] chore:setup docker compose --- .gitignore | 1 + README.md | 18 +++++++++++-- docker-compose.yml | 24 +++++++++++++++++ online-banking-app/pom.xml | 14 ++++++++-- .../src/main/resources/application.properties | 22 ++++++---------- pom.xml | 26 +++++++++---------- 6 files changed, 74 insertions(+), 31 deletions(-) create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index fa5b7ab..5285a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ log cms-db-schema/liquibase.properties ledgers-db/liquibase.properties +.env diff --git a/README.md b/README.md index 52f12f1..9429108 100644 --- a/README.md +++ b/README.md @@ -58,10 +58,24 @@ The **Webank Online Banking System** is a middleware service designed to connect mvn clean install mvn spring-boot:run ``` - -5. **Access API Documentation**: +4**Access API Documentation**: - The OpenAPI documentation will be available at `http://localhost:8080/swagger-ui.html` (or the port specified for each module). +## Starting application with Docker Compose + +1. Whilst inside the project root directory, Run the command +```bash + docker compose up --build + ``` +2. Access the API documentation at +```bash +http://localhost:9200/swagger-ui.html +``` +3. you can stop the application with +```bash +docker compose down +``` + ## Usage - **User Registration**: - Make a `POST` request to `/register` with `phoneNumber` and `publicKey`. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..53a7c79 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: '3.8' +services: + app: + build: + context: . + dockerfile: Dockerfile + ports: + - "9200:8080" + environment: + SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL} + SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME} + SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD} + depends_on: + - db + + db: + image: postgres:15 + container_name: postgres_container + ports: + - "5433:5432" + environment: + POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} diff --git a/online-banking-app/pom.xml b/online-banking-app/pom.xml index 91d29d3..b5ebf5d 100644 --- a/online-banking-app/pom.xml +++ b/online-banking-app/pom.xml @@ -66,12 +66,22 @@ org.springdoc springdoc-openapi-starter-webmvc-ui + + org.springframework.boot + spring-boot-starter-data-jpa + - com.h2database - h2 + org.postgresql + postgresql + 42.7.4 + + + + + org.projectlombok lombok diff --git a/online-banking-app/src/main/resources/application.properties b/online-banking-app/src/main/resources/application.properties index 38ea247..6843cf2 100644 --- a/online-banking-app/src/main/resources/application.properties +++ b/online-banking-app/src/main/resources/application.properties @@ -1,16 +1,10 @@ -# H2 Database Configuration -spring.h2.console.enabled=true -spring.datasource.url=jdbc:h2:mem:testdb +spring.profiles.active=postgres +spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/online_banking_db} +spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres} +spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres} -# Swagger Configuration -springdoc.api-docs.path=/api-docs -springdoc.swagger-ui.path=/swagger-ui.html - -# Additional Settings (if needed) -spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password= - -# Hibernate DDL auto (update, create-drop, validate, etc.) +# Configure the JPA and Hibernate settings spring.jpa.hibernate.ddl-auto=update -spring.cloud.compatibility-verifier.enabled=false +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect + diff --git a/pom.xml b/pom.xml index 7c08442..216e19f 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ 3.0.1 3.0.1 3.21.0 - 11.1.0 + 3.3.5 @@ -494,21 +494,21 @@ - - org.owasp - dependency-check-maven - ${owasp.dependency.check.version} - - - - check - - - + + + + + + + + + + + - + org.apache.maven.plugins From 7b902b80aa50e7e6d81a7ab366f57a5ea9720e0d Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Tue, 10 Dec 2024 14:30:25 +0100 Subject: [PATCH 05/25] config:setup profiles for database --- Dockerfile | 3 ++- online-banking-app/pom.xml | 11 +++++------ .../src/main/resources/application-h2.properties | 7 +++++++ .../main/resources/application-postgres.properties | 6 ++++++ .../src/main/resources/application.properties | 10 ++-------- pom.xml | 2 ++ 6 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 online-banking-app/src/main/resources/application-h2.properties create mode 100644 online-banking-app/src/main/resources/application-postgres.properties diff --git a/Dockerfile b/Dockerfile index e3e6e85..d931a52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,10 @@ FROM openjdk:17-jdk-slim WORKDIR /webank-OnlineBanking +ENV SPRING_PROFILES_ACTIVE=postgres + # py the JAR file from the online-banking-app module COPY ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar /webank-OnlineBanking/online-banking-app-0.1-SNAPSHOT.jar - # Expose the port your app runs on EXPOSE 8080 diff --git a/online-banking-app/pom.xml b/online-banking-app/pom.xml index b5ebf5d..ce1a292 100644 --- a/online-banking-app/pom.xml +++ b/online-banking-app/pom.xml @@ -31,7 +31,6 @@ ../ - com.adorsys.webank obs-rest-api @@ -74,13 +73,13 @@ org.postgresql postgresql - 42.7.4 - - - - + + com.h2database + h2 + + org.projectlombok diff --git a/online-banking-app/src/main/resources/application-h2.properties b/online-banking-app/src/main/resources/application-h2.properties new file mode 100644 index 0000000..2a4652a --- /dev/null +++ b/online-banking-app/src/main/resources/application-h2.properties @@ -0,0 +1,7 @@ +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect diff --git a/online-banking-app/src/main/resources/application-postgres.properties b/online-banking-app/src/main/resources/application-postgres.properties new file mode 100644 index 0000000..0eab640 --- /dev/null +++ b/online-banking-app/src/main/resources/application-postgres.properties @@ -0,0 +1,6 @@ +spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/online_banking_db} +spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres} +spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres} +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect diff --git a/online-banking-app/src/main/resources/application.properties b/online-banking-app/src/main/resources/application.properties index 6843cf2..4b62c9d 100644 --- a/online-banking-app/src/main/resources/application.properties +++ b/online-banking-app/src/main/resources/application.properties @@ -1,10 +1,4 @@ -spring.profiles.active=postgres -spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/online_banking_db} -spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres} -spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres} +# Default to H2 unless a specific profile is provided +spring.profiles.active=h2 -# Configure the JPA and Hibernate settings -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect diff --git a/pom.xml b/pom.xml index 216e19f..5e41621 100644 --- a/pom.xml +++ b/pom.xml @@ -97,6 +97,7 @@ 3.0.1 3.0.1 3.21.0 + @@ -111,6 +112,7 @@ 4.3 2.17.0 + 15.0 2.6.0 24.0.5 From 6794139ef8d3cc8cacdab0263dc7adca19ee03dc Mon Sep 17 00:00:00 2001 From: arielpetit Date: Mon, 16 Dec 2024 16:13:06 +0100 Subject: [PATCH 06/25] chore(): Add root URL redirection to Swagger UI --- .../com/adorsys/webank/config/RedirectConfig.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 online-banking-app/src/main/java/com/adorsys/webank/config/RedirectConfig.java diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/RedirectConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/RedirectConfig.java new file mode 100644 index 0000000..0900bc7 --- /dev/null +++ b/online-banking-app/src/main/java/com/adorsys/webank/config/RedirectConfig.java @@ -0,0 +1,14 @@ +package com.adorsys.webank.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class RedirectConfig implements WebMvcConfigurer { + + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/").setViewName("redirect:/swagger-ui.html"); + } +} From 2e2317f486bc8d327b670865a272176a38dd391f Mon Sep 17 00:00:00 2001 From: arielpetit Date: Mon, 16 Dec 2024 16:35:35 +0100 Subject: [PATCH 07/25] chore(): Updated the docker-build.yaml file to have thesha of the commit as tag --- .github/workflows/docker-build.yaml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 4bf08fb..8def09e 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -1,15 +1,17 @@ name: Build and Push Docker Image + on: - pull_request: + push: branches: - - main + - Create-workflow-for-build-image-to-GHCR + jobs: build: - if: github.event.pull_request.merged == true runs-on: ubuntu-latest permissions: packages: write contents: read + steps: - name: Checkout code uses: actions/checkout@v3 @@ -19,8 +21,9 @@ jobs: with: java-version: '17' distribution: 'temurin' + - name: Cache Maven packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} @@ -43,7 +46,10 @@ jobs: run: mvn -f online-banking-app/pom.xml clean package -DskipTests - name: Verify JAR File Exists - run: ls -l ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar + run: | + if [ ! -f ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar ]; then + echo "JAR file not found!" && exit 1 + fi - name: Log in to GHCR uses: docker/login-action@v3 @@ -54,8 +60,8 @@ jobs: - name: Build Docker image run: | - docker build -t ghcr.io/adorsys-gis/webank-online-banking:latest . + docker build -t ghcr.io/adorsys-gis/webank-online-banking:${{ github.sha }} . - name: Push Docker image to GHCR run: | - docker push ghcr.io/adorsys-gis/webank-online-banking:latest \ No newline at end of file + docker push ghcr.io/adorsys-gis/webank-online-banking:${{ github.sha }} From 682b42dacb52e324209f64aa584d9dc4957517a0 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Mon, 16 Dec 2024 16:46:17 +0100 Subject: [PATCH 08/25] chore(): Updated the docker-build.yaml file to have thesha of the commit as tag --- .github/workflows/docker-build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 8def09e..f8f5e7c 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -65,3 +65,4 @@ jobs: - name: Push Docker image to GHCR run: | docker push ghcr.io/adorsys-gis/webank-online-banking:${{ github.sha }} + From 2170cada7a93d814d89783acbee2e95ab5f53fe6 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Mon, 16 Dec 2024 16:56:33 +0100 Subject: [PATCH 09/25] chore(): Updated the docker-build.yaml file to have thesha of the commit as tag --- .github/workflows/docker-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index f8f5e7c..9932e2a 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -43,7 +43,7 @@ jobs: " > ~/.m2/settings.xml - name: Build JAR - run: mvn -f online-banking-app/pom.xml clean package -DskipTests + run: mvn clean package -DskipTests - name: Verify JAR File Exists run: | From 31d1575d895450655a881a51b7ab030f48712886 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Mon, 16 Dec 2024 17:05:54 +0100 Subject: [PATCH 10/25] chore(): Updated the deploy workflow to run on main branch --- .github/workflows/docker-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 9932e2a..578ef71 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -3,7 +3,7 @@ name: Build and Push Docker Image on: push: branches: - - Create-workflow-for-build-image-to-GHCR + - main jobs: build: From 1931ec1a1e4e11088a12710b3c56a5cd123d7162 Mon Sep 17 00:00:00 2001 From: Elwizzy12 Date: Tue, 17 Dec 2024 09:48:46 +0100 Subject: [PATCH 11/25] removed profile from dockerfile --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d931a52..1e18ccf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,6 @@ FROM openjdk:17-jdk-slim WORKDIR /webank-OnlineBanking -ENV SPRING_PROFILES_ACTIVE=postgres - # py the JAR file from the online-banking-app module COPY ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar /webank-OnlineBanking/online-banking-app-0.1-SNAPSHOT.jar # Expose the port your app runs on From 992bf6d4cdd5e9a7c1a9537590586b245e1a9019 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Tue, 17 Dec 2024 10:24:37 +0100 Subject: [PATCH 12/25] chore(): removed the cors config origin --- .../com/adorsys/webank/config/WebConfig.java | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java index 54d5530..1214af2 100644 --- a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java +++ b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java @@ -1,24 +1,24 @@ -package com.adorsys.webank.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class WebConfig { - - @Bean - public WebMvcConfigurer corsConfigurer() { - return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") - .allowedOrigins("https://dev.webank.gis.ssegning.com") - .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") - .allowedHeaders("*") - .allowCredentials(true); - } - }; - } -} +//package com.adorsys.webank.config; +// +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.web.servlet.config.annotation.CorsRegistry; +//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +// +//@Configuration +//public class WebConfig { +// +// @Bean +// public WebMvcConfigurer corsConfigurer() { +// return new WebMvcConfigurer() { +// @Override +// public void addCorsMappings(CorsRegistry registry) { +// registry.addMapping("/**") +// .allowedOrigins("https://dev.webank.gis.ssegning.com") +// .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") +// .allowedHeaders("*") +// .allowCredentials(true); +// } +// }; +// } +//} From 9d93c94a833072f79e1885d33ebb3be5f9d0f25a Mon Sep 17 00:00:00 2001 From: arielpetit Date: Tue, 17 Dec 2024 10:42:01 +0100 Subject: [PATCH 13/25] chore(): added the cors config origin --- .../com/adorsys/webank/config/WebConfig.java | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java index 1214af2..54d5530 100644 --- a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java +++ b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java @@ -1,24 +1,24 @@ -//package com.adorsys.webank.config; -// -//import org.springframework.context.annotation.Bean; -//import org.springframework.context.annotation.Configuration; -//import org.springframework.web.servlet.config.annotation.CorsRegistry; -//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -// -//@Configuration -//public class WebConfig { -// -// @Bean -// public WebMvcConfigurer corsConfigurer() { -// return new WebMvcConfigurer() { -// @Override -// public void addCorsMappings(CorsRegistry registry) { -// registry.addMapping("/**") -// .allowedOrigins("https://dev.webank.gis.ssegning.com") -// .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") -// .allowedHeaders("*") -// .allowCredentials(true); -// } -// }; -// } -//} +package com.adorsys.webank.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebConfig { + + @Bean + public WebMvcConfigurer corsConfigurer() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("https://dev.webank.gis.ssegning.com") + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") + .allowedHeaders("*") + .allowCredentials(true); + } + }; + } +} From 590c4e28c749aed397a72ffa34e606277b21e777 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Tue, 17 Dec 2024 10:47:15 +0100 Subject: [PATCH 14/25] chore(): removed the origins --- .../src/main/java/com/adorsys/webank/config/WebConfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java index 54d5530..c3d69f0 100644 --- a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java +++ b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java @@ -14,7 +14,6 @@ public WebMvcConfigurer corsConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") - .allowedOrigins("https://dev.webank.gis.ssegning.com") .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") .allowedHeaders("*") .allowCredentials(true); From ceb31d253d5a4045e619442239d4c27c3aabb5b2 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 09:50:50 +0100 Subject: [PATCH 15/25] chore(): added test endpoint to display host --- .../com/adorsys/webank/obs/resource/Host.java | 26 +++++++++++++++++++ .../obs/resource/RegistrationResource.java | 7 ++++- .../com/adorsys/webank/config/WebConfig.java | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java diff --git a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java new file mode 100644 index 0000000..415d093 --- /dev/null +++ b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java @@ -0,0 +1,26 @@ +package com.adorsys.webank.obs.resource; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import jakarta.servlet.http.HttpServletRequest; + + +@RestController +@RequestMapping("/api") +public class Host { + + @GetMapping("/host") + public String getApplicationUrl(HttpServletRequest request) { + // Construct the URL + String scheme = request.getScheme(); // http or https + String serverName = request.getServerName(); // localhost or domain + int serverPort = request.getServerPort(); // port number + String contextPath = request.getContextPath(); // application context path (if any) + + // Format the URL + String url = String.format("%s://%s:%d%s", scheme, serverName, serverPort, contextPath); + + return url; + } +} \ No newline at end of file diff --git a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java index 7d7a755..cd4ddeb 100644 --- a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java +++ b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java @@ -2,6 +2,9 @@ import com.adorsys.webank.obs.dto.RegistrationRequest; import com.adorsys.webank.obs.service.RegistrationServiceApi; +import jakarta.servlet.http.HttpServletRequest; +import org.apache.catalina.filters.ExpiresFilter; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.http.HttpStatus; @@ -13,10 +16,12 @@ public class RegistrationResource implements RegistrationResourceApi { @Autowired private RegistrationServiceApi registrationService; - + @Autowired + private HttpServletRequest request; @Override @PostMapping public ResponseEntity registerAccount(@RequestBody RegistrationRequest registrationRequest) { + System.out.println(request.getRequestURL()); try { String result = registrationService.registerAccount(registrationRequest); return ResponseEntity.status(HttpStatus.CREATED).body(result); diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java index c3d69f0..54d5530 100644 --- a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java +++ b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java @@ -14,6 +14,7 @@ public WebMvcConfigurer corsConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") + .allowedOrigins("https://dev.webank.gis.ssegning.com") .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") .allowedHeaders("*") .allowCredentials(true); From ca3b466b190f0d9849587f0deb3610be43dd45f3 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 09:55:58 +0100 Subject: [PATCH 16/25] chore(): fixed pmd check --- .../com/adorsys/webank/obs/resource/RegistrationResource.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java index cd4ddeb..1a9bab7 100644 --- a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java +++ b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java @@ -3,8 +3,6 @@ import com.adorsys.webank.obs.dto.RegistrationRequest; import com.adorsys.webank.obs.service.RegistrationServiceApi; import jakarta.servlet.http.HttpServletRequest; -import org.apache.catalina.filters.ExpiresFilter; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.http.HttpStatus; From 1f82b37c0cce5243ed6e6eea1f2dd2ea99898e53 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 10:04:50 +0100 Subject: [PATCH 17/25] chore(): fixed pmd check --- .../src/main/java/com/adorsys/webank/obs/resource/Host.java | 4 +--- .../com/adorsys/webank/obs/resource/RegistrationResource.java | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java index 415d093..5045a44 100644 --- a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java +++ b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java @@ -19,8 +19,6 @@ public String getApplicationUrl(HttpServletRequest request) { String contextPath = request.getContextPath(); // application context path (if any) // Format the URL - String url = String.format("%s://%s:%d%s", scheme, serverName, serverPort, contextPath); - - return url; + return String.format("%s://%s:%d%s", scheme, serverName, serverPort, contextPath); } } \ No newline at end of file diff --git a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java index 1a9bab7..a631753 100644 --- a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java +++ b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java @@ -14,12 +14,9 @@ public class RegistrationResource implements RegistrationResourceApi { @Autowired private RegistrationServiceApi registrationService; - @Autowired - private HttpServletRequest request; @Override @PostMapping public ResponseEntity registerAccount(@RequestBody RegistrationRequest registrationRequest) { - System.out.println(request.getRequestURL()); try { String result = registrationService.registerAccount(registrationRequest); return ResponseEntity.status(HttpStatus.CREATED).body(result); From a795f98d92474933f5f13508943e2d9785b9c0e5 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 10:41:07 +0100 Subject: [PATCH 18/25] chore(): added the X-fowarded trusting --- .../com/adorsys/webank/obs/resource/RegistrationResource.java | 1 - online-banking-app/src/main/resources/application.properties | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java index a631753..becbc22 100644 --- a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java +++ b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/RegistrationResource.java @@ -2,7 +2,6 @@ import com.adorsys.webank.obs.dto.RegistrationRequest; import com.adorsys.webank.obs.service.RegistrationServiceApi; -import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.http.HttpStatus; diff --git a/online-banking-app/src/main/resources/application.properties b/online-banking-app/src/main/resources/application.properties index 4b62c9d..13c2dc4 100644 --- a/online-banking-app/src/main/resources/application.properties +++ b/online-banking-app/src/main/resources/application.properties @@ -1,4 +1,5 @@ # Default to H2 unless a specific profile is provided spring.profiles.active=h2 +server.forward-headers-strategy=native From 005c0f85de656ad01d074ebcbc827f3be2ac76d7 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 11:31:37 +0100 Subject: [PATCH 19/25] chore(): removed the cors config --- .../com/adorsys/webank/obs/resource/Host.java | 18 +++++++++++++----- .../com/adorsys/webank/config/WebConfig.java | 9 +-------- .../main/resources/application-h2.properties | 1 + .../resources/application-postgres.properties | 1 + 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java index 5045a44..d42a8bd 100644 --- a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java +++ b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java @@ -5,6 +5,8 @@ import org.springframework.web.bind.annotation.RestController; import jakarta.servlet.http.HttpServletRequest; +import java.util.Enumeration; + @RestController @RequestMapping("/api") @@ -13,12 +15,18 @@ public class Host { @GetMapping("/host") public String getApplicationUrl(HttpServletRequest request) { // Construct the URL - String scheme = request.getScheme(); // http or https - String serverName = request.getServerName(); // localhost or domain - int serverPort = request.getServerPort(); // port number - String contextPath = request.getContextPath(); // application context path (if any) + StringBuilder sb = new StringBuilder(); + sb.append("scheme: ").append(request.getScheme()).append("\n"); // http or https + sb.append("serverName: ").append(request.getServerName()).append("\n"); + sb.append("serverPort: ").append(request.getServerPort()).append("\n"); // localhost or domain + sb.append("contextPath: ").append(request.getContextPath()).append("\n"); // localhost or domain + Enumeration headerNames = request.getHeaderNames(); + while (headerNames.hasMoreElements()) { + String headerName = headerNames.nextElement(); + sb.append(headerName + ": ").append(request.getHeaders(headerName)).append("\n"); + } // Format the URL - return String.format("%s://%s:%d%s", scheme, serverName, serverPort, contextPath); + return sb.toString(); } } \ No newline at end of file diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java index 54d5530..04cff13 100644 --- a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java +++ b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java @@ -11,14 +11,7 @@ public class WebConfig { @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") - .allowedOrigins("https://dev.webank.gis.ssegning.com") - .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") - .allowedHeaders("*") - .allowCredentials(true); - } + }; } } diff --git a/online-banking-app/src/main/resources/application-h2.properties b/online-banking-app/src/main/resources/application-h2.properties index 2a4652a..ac2e141 100644 --- a/online-banking-app/src/main/resources/application-h2.properties +++ b/online-banking-app/src/main/resources/application-h2.properties @@ -5,3 +5,4 @@ spring.datasource.password= spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.show-sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect +server.forward-headers-strategy=native diff --git a/online-banking-app/src/main/resources/application-postgres.properties b/online-banking-app/src/main/resources/application-postgres.properties index 0eab640..099b48f 100644 --- a/online-banking-app/src/main/resources/application-postgres.properties +++ b/online-banking-app/src/main/resources/application-postgres.properties @@ -4,3 +4,4 @@ spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres} spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +server.forward-headers-strategy=native From 85dfbbad75894363e298440bd97bfa038e0f49e8 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 11:49:38 +0100 Subject: [PATCH 20/25] chore(): removed the cors config --- .../com/adorsys/webank/obs/resource/Host.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java index d42a8bd..9fb93d6 100644 --- a/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java +++ b/obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java @@ -7,7 +7,6 @@ import java.util.Enumeration; - @RestController @RequestMapping("/api") public class Host { @@ -17,16 +16,23 @@ public String getApplicationUrl(HttpServletRequest request) { // Construct the URL StringBuilder sb = new StringBuilder(); sb.append("scheme: ").append(request.getScheme()).append("\n"); // http or https - sb.append("serverName: ").append(request.getServerName()).append("\n"); - sb.append("serverPort: ").append(request.getServerPort()).append("\n"); // localhost or domain - sb.append("contextPath: ").append(request.getContextPath()).append("\n"); // localhost or domain + sb.append("serverName: ").append(request.getServerName()).append("\n"); // server name + sb.append("serverPort: ").append(request.getServerPort()).append("\n"); // server port + sb.append("contextPath: ").append(request.getContextPath()).append("\n"); // application context path (if any) + Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String headerName = headerNames.nextElement(); - sb.append(headerName + ": ").append(request.getHeaders(headerName)).append("\n"); + sb.append(headerName).append(": "); + + Enumeration headers = request.getHeaders(headerName); + while (headers.hasMoreElements()) { + sb.append(headers.nextElement()).append(" "); + } + sb.append("\n"); } // Format the URL return sb.toString(); } -} \ No newline at end of file +} From da24f4deb4a270ef0a9b2cb95cf7a1ad7676c20b Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 12:04:15 +0100 Subject: [PATCH 21/25] chore(): added x-forwarded config --- .../src/main/resources/application-postgres.properties | 2 ++ online-banking-app/src/main/resources/application.properties | 2 ++ 2 files changed, 4 insertions(+) diff --git a/online-banking-app/src/main/resources/application-postgres.properties b/online-banking-app/src/main/resources/application-postgres.properties index 099b48f..a3ee75d 100644 --- a/online-banking-app/src/main/resources/application-postgres.properties +++ b/online-banking-app/src/main/resources/application-postgres.properties @@ -5,3 +5,5 @@ spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect server.forward-headers-strategy=native +server.tomcat.remote-ip-header=x-forwarded-for +server.tomcat.protocol-header=x-forwarded-proto diff --git a/online-banking-app/src/main/resources/application.properties b/online-banking-app/src/main/resources/application.properties index 13c2dc4..e78c79d 100644 --- a/online-banking-app/src/main/resources/application.properties +++ b/online-banking-app/src/main/resources/application.properties @@ -1,5 +1,7 @@ # Default to H2 unless a specific profile is provided spring.profiles.active=h2 server.forward-headers-strategy=native +server.tomcat.remote-ip-header=x-forwarded-for +server.tomcat.protocol-header=x-forwarded-proto From 88d00da37a25d74676da1f2851c65889f841b4b9 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 12:40:52 +0100 Subject: [PATCH 22/25] chore(): added x-forwarded config --- .../obs/resource/RegistrationResourceApi.java | 1 - .../webank/config/ForwardedHeaderConfig.java | 14 ++++++++++++++ .../src/main/resources/application.properties | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java diff --git a/obs/obs-rest-api/src/main/java/com/adorsys/webank/obs/resource/RegistrationResourceApi.java b/obs/obs-rest-api/src/main/java/com/adorsys/webank/obs/resource/RegistrationResourceApi.java index cb97c78..6925811 100644 --- a/obs/obs-rest-api/src/main/java/com/adorsys/webank/obs/resource/RegistrationResourceApi.java +++ b/obs/obs-rest-api/src/main/java/com/adorsys/webank/obs/resource/RegistrationResourceApi.java @@ -9,7 +9,6 @@ @RestController @RequestMapping("/api/registration") -@CrossOrigin(origins = "http://localhost:5173") public interface RegistrationResourceApi { @Operation(summary = "Register a new bank account", description = "Accepts a phone number and public key for registration") diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java new file mode 100644 index 0000000..d781337 --- /dev/null +++ b/online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java @@ -0,0 +1,14 @@ +package com.adorsys.webank.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.ForwardedHeaderFilter; + +@Configuration +public class ForwardedHeaderConfig { + + @Bean + public ForwardedHeaderFilter forwardedHeaderFilter() { + return new ForwardedHeaderFilter(); + } +} diff --git a/online-banking-app/src/main/resources/application.properties b/online-banking-app/src/main/resources/application.properties index e78c79d..5b97b8f 100644 --- a/online-banking-app/src/main/resources/application.properties +++ b/online-banking-app/src/main/resources/application.properties @@ -3,5 +3,5 @@ spring.profiles.active=h2 server.forward-headers-strategy=native server.tomcat.remote-ip-header=x-forwarded-for server.tomcat.protocol-header=x-forwarded-proto - - +# Ensure Tomcat handles forwarded headers +server.tomcat.forward-headers-strategy=native From b62642e12a613c98d0408803958823da124c28eb Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 13:00:14 +0100 Subject: [PATCH 23/25] chore(): added x-forwarded config manually --- .../src/main/resources/application-h2.properties | 1 - .../src/main/resources/application-postgres.properties | 3 --- .../src/main/resources/application.properties | 8 +++----- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/online-banking-app/src/main/resources/application-h2.properties b/online-banking-app/src/main/resources/application-h2.properties index ac2e141..2a4652a 100644 --- a/online-banking-app/src/main/resources/application-h2.properties +++ b/online-banking-app/src/main/resources/application-h2.properties @@ -5,4 +5,3 @@ spring.datasource.password= spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.show-sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect -server.forward-headers-strategy=native diff --git a/online-banking-app/src/main/resources/application-postgres.properties b/online-banking-app/src/main/resources/application-postgres.properties index a3ee75d..0eab640 100644 --- a/online-banking-app/src/main/resources/application-postgres.properties +++ b/online-banking-app/src/main/resources/application-postgres.properties @@ -4,6 +4,3 @@ spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres} spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -server.forward-headers-strategy=native -server.tomcat.remote-ip-header=x-forwarded-for -server.tomcat.protocol-header=x-forwarded-proto diff --git a/online-banking-app/src/main/resources/application.properties b/online-banking-app/src/main/resources/application.properties index 5b97b8f..e33b028 100644 --- a/online-banking-app/src/main/resources/application.properties +++ b/online-banking-app/src/main/resources/application.properties @@ -1,7 +1,5 @@ # Default to H2 unless a specific profile is provided spring.profiles.active=h2 -server.forward-headers-strategy=native -server.tomcat.remote-ip-header=x-forwarded-for -server.tomcat.protocol-header=x-forwarded-proto -# Ensure Tomcat handles forwarded headers -server.tomcat.forward-headers-strategy=native + + + From b94e564f4418e28b43406971c980ba2025f60c92 Mon Sep 17 00:00:00 2001 From: arielpetit Date: Wed, 18 Dec 2024 13:09:08 +0100 Subject: [PATCH 24/25] chore(): added x-forwarded config manually --- .../webank/config/ForwardedHeaderConfig.java | 28 +++++++++---------- .../com/adorsys/webank/config/WebConfig.java | 17 ----------- .../src/main/resources/application.properties | 1 + 3 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java index d781337..deccc52 100644 --- a/online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java +++ b/online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java @@ -1,14 +1,14 @@ -package com.adorsys.webank.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.filter.ForwardedHeaderFilter; - -@Configuration -public class ForwardedHeaderConfig { - - @Bean - public ForwardedHeaderFilter forwardedHeaderFilter() { - return new ForwardedHeaderFilter(); - } -} +//package com.adorsys.webank.config; +// +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.web.filter.ForwardedHeaderFilter; +// +//@Configuration +//public class ForwardedHeaderConfig { +// +// @Bean +// public ForwardedHeaderFilter forwardedHeaderFilter() { +// return new ForwardedHeaderFilter(); +// } +//} diff --git a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java b/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java deleted file mode 100644 index 04cff13..0000000 --- a/online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.adorsys.webank.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class WebConfig { - - @Bean - public WebMvcConfigurer corsConfigurer() { - return new WebMvcConfigurer() { - - }; - } -} diff --git a/online-banking-app/src/main/resources/application.properties b/online-banking-app/src/main/resources/application.properties index e33b028..db13bb7 100644 --- a/online-banking-app/src/main/resources/application.properties +++ b/online-banking-app/src/main/resources/application.properties @@ -1,5 +1,6 @@ # Default to H2 unless a specific profile is provided spring.profiles.active=h2 +server.forward-headers-strategy=framework From 06972b4917468eb16aa4c6c47a5190d2edf30afe Mon Sep 17 00:00:00 2001 From: yvanhenang Date: Thu, 19 Dec 2024 08:33:53 +0100 Subject: [PATCH 25/25] remove h2 into application.properties --- online-banking-app/src/main/resources/application.properties | 2 -- 1 file changed, 2 deletions(-) diff --git a/online-banking-app/src/main/resources/application.properties b/online-banking-app/src/main/resources/application.properties index db13bb7..af3adb3 100644 --- a/online-banking-app/src/main/resources/application.properties +++ b/online-banking-app/src/main/resources/application.properties @@ -1,5 +1,3 @@ -# Default to H2 unless a specific profile is provided -spring.profiles.active=h2 server.forward-headers-strategy=framework