From 3f5a03991281c50217535f89e41cc7d23ba93572 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Wed, 4 Jan 2023 11:09:24 +0100 Subject: [PATCH 01/30] Fix #204: Update Spring Boot to 2.7.7 --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 83ce5d5a..b12501e4 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.6.14 + 2.7.7 From 573785111167f83af9188622dd05eace838c5182 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Thu, 5 Jan 2023 07:57:20 +0100 Subject: [PATCH 02/30] Fix #200: Set develop version to 1.5.0-SNAPSHOT --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 5ae9227b..2f2914cb 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -5,7 +5,7 @@ powerauth-data-adapter io.getlime.security - 1.4.0 + 1.5.0-SNAPSHOT war powerauth-data-adapter From 0e3e41e05f8c639d72a628fa7b8c5de446c65ccf Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Tue, 31 Jan 2023 17:04:29 +0100 Subject: [PATCH 03/30] Remove travis configuration --- .travis.yml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 42e30564..00000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: java -jdk: - - openjdk11 -script: mvn -f powerauth-data-adapter/pom.xml clean package -branches: - only: - - master - - coverity_scan -env: - global: - - secure: "ZeE+S5KU4rA0zta+udAFBIEETAqTg5SExaFtoNur/2DG79hcGGO/nC1VouwbwYnR81xNc3A5LniTsqwYjzFFstCRUPR7zjeYIq4B9v5bdNqdLiRvY/Re9Rk9f4hVf3039SnKGaEC+iCMzs/BxFW5+y68Oe1RKGh9yI0I2WKglkIw3NHLx+qI4HBhWwgso2USBNGGfEPOwJAR0940DxLywOxNFPUuMjYIFXY7Yx6Hko0L7BX+TRERmJuxK+cwoTWkFdmAzNIsau2WpSHN2/V+kIP8sr9eeUc33pY9ztW+oir3kteDhNjPeg9NA+FG6bGC8D8hPzNIMEED/OPs/Zj3G0oOLLTS/fjulSAiTAK6afkEyffNjVfh7dJQxvfGhHBJs1PDD0+a7sYogmf/eisxO6qYI+hRZMpkjjJL590Ovk6do9anzzmJ8lSSH6r8NVCANt2q5fnjp5BOOPFWGolWMvH2r699TiL3azBM1lWz3spvvk11DbtWqDJCOFmtD4SluTFAKuZjageQY69nPpB/w3Q+ThpYJqTNNrHD1i/b5daAi8aIGZud5vvwTUC5ItGzSGhjizTFxps7FOa77P//YIQhdirURvgIkuCf0A5vGBABuyeVOmz3pkx36sO4va1ZqNNYY9tbv5rdCBynU0KgmrOr6J3Q6IwMSxrc85ykSlI=" - -before_install: - - echo -n | openssl s_client -connect https://scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- - -addons: - coverity_scan: - project: - name: "wultra/powerauth-webflow-customization" - description: "Build submitted via Travis CI" - notification_email: roman.strobl@wultra.com - build_command_prepend: "mvn -f powerauth-data-adapter/pom.xml clean" - build_command: "mvn -DskipTests=true -f powerauth-data-adapter/pom.xml compile" - branch_pattern: coverity_scan From 5d7edd89c17f2f6ce226268f61e0d4193ac37157 Mon Sep 17 00:00:00 2001 From: "roman.strobl@wultra.com" Date: Mon, 6 Feb 2023 12:01:19 +0100 Subject: [PATCH 04/30] Fix #225: Typo in owas-dependecy-check.yml --- .../{owas-dependecy-check.yml => owasp-dependecy-check.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{owas-dependecy-check.yml => owasp-dependecy-check.yml} (100%) diff --git a/.github/workflows/owas-dependecy-check.yml b/.github/workflows/owasp-dependecy-check.yml similarity index 100% rename from .github/workflows/owas-dependecy-check.yml rename to .github/workflows/owasp-dependecy-check.yml From 913c16fd765dff496efd8ad2bd0d492c46077feb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 09:48:56 +0000 Subject: [PATCH 05/30] Bump spring-boot-starter-parent in /powerauth-data-adapter Bumps [spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 2.7.7 to 2.7.10. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.7.7...v2.7.10) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-starter-parent dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 50c4e34a..acda4d79 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.7 + 2.7.10 From ed8bc769fddfcb74a043e277ec543ab2d108d4f3 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Mon, 27 Mar 2023 14:32:21 +0200 Subject: [PATCH 06/30] Fix #228: Add Liquibase support --- .run/DataAdapterApplication.run.xml | 12 +++ doc-private/Developer-How-To-Start.md | 24 ++++++ .../1.4.x/20230326-init-db.xml | 76 +++++++++++++++++++ .../1.4.x/20230327-add-tag-1.4.0.xml | 10 +++ .../1.4.x/db.changelog-version.xml | 9 +++ .../1.5.x/db.changelog-version.xml | 6 ++ .../db.changelog-module.xml | 16 ++++ docs/db/changelog/db.changelog-master.xml | 8 ++ powerauth-data-adapter/pom.xml | 48 ++++++++++++ .../main/resources/application-dev.properties | 3 + .../src/main/resources/application.properties | 1 + 11 files changed, 213 insertions(+) create mode 100644 .run/DataAdapterApplication.run.xml create mode 100644 doc-private/Developer-How-To-Start.md create mode 100644 docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/20230326-init-db.xml create mode 100644 docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/20230327-add-tag-1.4.0.xml create mode 100644 docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/db.changelog-version.xml create mode 100644 docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/db.changelog-version.xml create mode 100644 docs/db/changelog/changesets/powerauth-data-adapter/db.changelog-module.xml create mode 100644 docs/db/changelog/db.changelog-master.xml create mode 100644 powerauth-data-adapter/src/main/resources/application-dev.properties diff --git a/.run/DataAdapterApplication.run.xml b/.run/DataAdapterApplication.run.xml new file mode 100644 index 00000000..8a01e6f5 --- /dev/null +++ b/.run/DataAdapterApplication.run.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/doc-private/Developer-How-To-Start.md b/doc-private/Developer-How-To-Start.md new file mode 100644 index 00000000..6a2538d1 --- /dev/null +++ b/doc-private/Developer-How-To-Start.md @@ -0,0 +1,24 @@ +# Developer - How to Start Guide + + +## PowerAuth Data Adapter + + +### Standalone Run + +- Enable maven profile `standalone` +- Use IntelliJ Idea run configuration at `../.run/DataAdapterApplication.run.xml` +- Open [http://localhost:9090/powerauth-data-adapter/actuator/health](http://localhost:9090/powerauth-data-adapter/actuator/health) and you should get `{"status":"UP"}` + + +### Database + +Database changes are driven by Liquibase. + +This is an example how to manually check the Liquibase status. +Important and fixed parameter is `changelog-file`. +Others (like URL, username, password) depend on your environment. + +```shell +liquibase --changelog-file=./docs/db/changelog/changesets/powerauth-data-adapter/db.changelog-module.xml --url=jdbc:postgresql://localhost:5432/powerauth --username=powerauth --hub-mode=off status +``` diff --git a/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/20230326-init-db.xml b/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/20230326-init-db.xml new file mode 100644 index 00000000..5f6bc55b --- /dev/null +++ b/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/20230326-init-db.xml @@ -0,0 +1,76 @@ + + + + + + + + + + Create a new table da_sms_authorization + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create a new table da_user_credentials + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/20230327-add-tag-1.4.0.xml b/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/20230327-add-tag-1.4.0.xml new file mode 100644 index 00000000..46995de0 --- /dev/null +++ b/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/20230327-add-tag-1.4.0.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/db.changelog-version.xml b/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/db.changelog-version.xml new file mode 100644 index 00000000..c28af570 --- /dev/null +++ b/docs/db/changelog/changesets/powerauth-data-adapter/1.4.x/db.changelog-version.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/db.changelog-version.xml b/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/db.changelog-version.xml new file mode 100644 index 00000000..6645fa83 --- /dev/null +++ b/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/db.changelog-version.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/docs/db/changelog/changesets/powerauth-data-adapter/db.changelog-module.xml b/docs/db/changelog/changesets/powerauth-data-adapter/db.changelog-module.xml new file mode 100644 index 00000000..9599a2fe --- /dev/null +++ b/docs/db/changelog/changesets/powerauth-data-adapter/db.changelog-module.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/db/changelog/db.changelog-master.xml b/docs/db/changelog/db.changelog-master.xml new file mode 100644 index 00000000..8aadb531 --- /dev/null +++ b/docs/db/changelog/db.changelog-master.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index acda4d79..f7cc50bb 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -218,6 +218,54 @@ true + + + standalone + + + org.postgresql + postgresql + + + + + + liquibase + + + org.liquibase + liquibase-core + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-resources + process-resources + + copy-resources + + + ${basedir}/target/classes/db/changelog + + + ../docs/db/changelog/changesets/${project.artifactId} + + **/*.* + + + + + + + + + + diff --git a/powerauth-data-adapter/src/main/resources/application-dev.properties b/powerauth-data-adapter/src/main/resources/application-dev.properties new file mode 100644 index 00000000..524c75a0 --- /dev/null +++ b/powerauth-data-adapter/src/main/resources/application-dev.properties @@ -0,0 +1,3 @@ +# Liquibase +spring.liquibase.enabled=true +spring.liquibase.change-log=classpath:db/changelog/db.changelog-module.xml diff --git a/powerauth-data-adapter/src/main/resources/application.properties b/powerauth-data-adapter/src/main/resources/application.properties index 474b7905..ac2ebf0a 100644 --- a/powerauth-data-adapter/src/main/resources/application.properties +++ b/powerauth-data-adapter/src/main/resources/application.properties @@ -6,6 +6,7 @@ spring.datasource.url=jdbc:postgresql://localhost:5432/postgres spring.datasource.username=powerauth spring.datasource.password= spring.datasource.driver-class-name=org.postgresql.Driver +spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false spring.jpa.properties.hibernate.connection.characterEncoding=utf8 spring.jpa.properties.hibernate.connection.useUnicode=true From 1d50b133b819d59c600e8e283132dd9b5708c3c5 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Thu, 30 Mar 2023 14:32:05 +0200 Subject: [PATCH 07/30] Fix #230: Turn off auto-commit --- powerauth-data-adapter/src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/powerauth-data-adapter/src/main/resources/application.properties b/powerauth-data-adapter/src/main/resources/application.properties index ac2ebf0a..b2e2b1f6 100644 --- a/powerauth-data-adapter/src/main/resources/application.properties +++ b/powerauth-data-adapter/src/main/resources/application.properties @@ -5,6 +5,7 @@ spring.profiles.active=ext spring.datasource.url=jdbc:postgresql://localhost:5432/postgres spring.datasource.username=powerauth spring.datasource.password= +spring.datasource.hikari.auto-commit=false spring.datasource.driver-class-name=org.postgresql.Driver spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false From d58f36a24d288d12a15383a95240c0776ff3799e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:02:18 +0000 Subject: [PATCH 08/30] Bump bcprov-jdk18on from 1.72 to 1.73 in /powerauth-data-adapter Bumps [bcprov-jdk18on](https://github.com/bcgit/bc-java) from 1.72 to 1.73. - [Release notes](https://github.com/bcgit/bc-java/releases) - [Changelog](https://github.com/bcgit/bc-java/blob/master/docs/releasenotes.html) - [Commits](https://github.com/bcgit/bc-java/commits) --- updated-dependencies: - dependency-name: org.bouncycastle:bcprov-jdk18on dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index f7cc50bb..0215f535 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -123,7 +123,7 @@ org.bouncycastle bcprov-jdk18on - 1.72 + 1.73 From 93cae04c4ee4d1f33a5dc4be4e273c4777d7a8cb Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Wed, 3 May 2023 08:28:31 +0200 Subject: [PATCH 09/30] Remove OWASP Dependency Check GitHub Action --- .github/workflows/owasp-dependecy-check.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .github/workflows/owasp-dependecy-check.yml diff --git a/.github/workflows/owasp-dependecy-check.yml b/.github/workflows/owasp-dependecy-check.yml deleted file mode 100644 index c4d5d262..00000000 --- a/.github/workflows/owasp-dependecy-check.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Run OWASP Dependency Check -on: - workflow_dispatch: - - push: - branches: - - 'develop' - -jobs: - owasp-check: - uses: wultra/wultra-infrastructure/.github/workflows/owasp-dependency-check.yml@develop - secrets: inherit - with: - directory_path: powerauth-data-adapter \ No newline at end of file From cb22ab58c8073f434bd93398c745c470d23aa367 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Wed, 3 May 2023 09:10:42 +0200 Subject: [PATCH 10/30] Fix #234: Upgrade Spring Boot 3 --- .github/workflows/codeql-analysis.yml | 9 +++++- docs/Deploying-Wildfly.md | 2 +- powerauth-data-adapter/pom.xml | 32 ++++--------------- .../configuration/OpenApiConfiguration.java | 2 +- .../configuration/SecurityConfiguration.java | 18 +++++++---- .../controller/AuthMethodController.java | 3 +- .../controller/AuthenticationController.java | 3 +- .../controller/CertificateController.java | 2 +- .../controller/ConsentController.java | 2 +- .../SmsAuthorizationController.java | 3 +- .../model/entity/SmsAuthorizationEntity.java | 9 +++--- .../src/main/resources/application.properties | 10 ------ 12 files changed, 38 insertions(+), 57 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 04e04ece..64753c87 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,7 +35,14 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: maven # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/docs/Deploying-Wildfly.md b/docs/Deploying-Wildfly.md index 5d726f6f..63e4fe62 100644 --- a/docs/Deploying-Wildfly.md +++ b/docs/Deploying-Wildfly.md @@ -19,7 +19,7 @@ Data Adapter contains the following configuration in `jboss-deployment-structure - + diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 0215f535..e7dd718b 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.10 + 3.0.6 @@ -62,13 +62,10 @@ - UTF-8 - 11 - 11 - 3.3.2 + 2.1.0 - 1.4.0 - 1.4.0 + 1.5.0-SNAPSHOT + 1.5.0-SNAPSHOT @@ -126,29 +123,12 @@ 1.73 - - - javax.xml.bind - jaxb-api - - - org.glassfish.jaxb - jaxb-runtime - - org.springdoc - springdoc-openapi-ui - 1.6.14 - - - - com.google.guava - guava - 31.1-jre + springdoc-openapi-starter-webmvc-ui + ${springdoc-openapi-starter-webmvc-ui.version} - diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/configuration/OpenApiConfiguration.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/configuration/OpenApiConfiguration.java index bf94dfa0..b8c003d7 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/configuration/OpenApiConfiguration.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/configuration/OpenApiConfiguration.java @@ -19,7 +19,7 @@ import io.swagger.v3.oas.annotations.info.Contact; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.info.License; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/configuration/SecurityConfiguration.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/configuration/SecurityConfiguration.java index 1c0d26e3..ad07dc13 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/configuration/SecurityConfiguration.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/configuration/SecurityConfiguration.java @@ -16,9 +16,12 @@ package io.getlime.security.powerauth.app.dataadapter.configuration; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.web.SecurityFilterChain; /** * Default Spring Security configuration. @@ -26,17 +29,20 @@ * @author Petr Dvorak, petr@wultra.com */ @Configuration -public class SecurityConfiguration extends WebSecurityConfigurerAdapter { +@EnableWebSecurity +public class SecurityConfiguration { /** * Configures HTTP security. * @param http HTTP security. * @throws Exception Thrown when configuration fails. */ - @Override - protected void configure(HttpSecurity http) throws Exception { - http.httpBasic().disable(); - http.csrf().disable(); + @Bean + public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception { + return http + .httpBasic(AbstractHttpConfigurer::disable) + .csrf(AbstractHttpConfigurer::disable) + .build(); } } \ No newline at end of file diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AuthMethodController.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AuthMethodController.java index d85e5761..ba2ea8d0 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AuthMethodController.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AuthMethodController.java @@ -25,14 +25,13 @@ import io.getlime.security.powerauth.lib.dataadapter.model.request.InitAuthMethodRequest; import io.getlime.security.powerauth.lib.dataadapter.model.response.InitAuthMethodResponse; import io.getlime.security.powerauth.lib.nextstep.model.enumeration.AuthMethod; +import jakarta.validation.Valid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; - /** * Controller class which handles authentication method configuration. * diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AuthenticationController.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AuthenticationController.java index cb7dea69..5eae42b7 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AuthenticationController.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AuthenticationController.java @@ -28,14 +28,13 @@ import io.getlime.security.powerauth.lib.dataadapter.model.request.UserLookupRequest; import io.getlime.security.powerauth.lib.dataadapter.model.response.UserAuthenticationResponse; import io.getlime.security.powerauth.lib.dataadapter.model.response.UserDetailResponse; +import jakarta.validation.Valid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; - /** * Controller class which handles user authentication. * diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/CertificateController.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/CertificateController.java index 0c784462..289d763a 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/CertificateController.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/CertificateController.java @@ -27,13 +27,13 @@ import io.getlime.security.powerauth.lib.dataadapter.model.response.VerifyCertificateResponse; import io.getlime.security.powerauth.lib.nextstep.model.enumeration.AuthInstrument; import io.getlime.security.powerauth.lib.nextstep.model.enumeration.AuthMethod; +import jakarta.validation.Valid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; /** * Controller class which handles SMS OTP authorization. diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/ConsentController.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/ConsentController.java index 7d7cfe21..41065f33 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/ConsentController.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/ConsentController.java @@ -33,13 +33,13 @@ import io.getlime.security.powerauth.lib.dataadapter.model.response.InitConsentFormResponse; import io.getlime.security.powerauth.lib.dataadapter.model.response.SaveConsentFormResponse; import io.getlime.security.powerauth.lib.dataadapter.model.response.ValidateConsentFormResponse; +import jakarta.validation.Valid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; import java.util.List; /** diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/SmsAuthorizationController.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/SmsAuthorizationController.java index b3a838ef..706eb00c 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/SmsAuthorizationController.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/SmsAuthorizationController.java @@ -33,14 +33,13 @@ import io.getlime.security.powerauth.lib.dataadapter.model.response.VerifySmsAndPasswordResponse; import io.getlime.security.powerauth.lib.dataadapter.model.response.VerifySmsAuthorizationResponse; import io.getlime.security.powerauth.lib.nextstep.model.enumeration.AuthMethod; +import jakarta.validation.Valid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; - /** * Controller class which handles SMS OTP authorization. * diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/repository/model/entity/SmsAuthorizationEntity.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/repository/model/entity/SmsAuthorizationEntity.java index c40dea6f..afd2b718 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/repository/model/entity/SmsAuthorizationEntity.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/repository/model/entity/SmsAuthorizationEntity.java @@ -15,10 +15,11 @@ */ package io.getlime.security.powerauth.app.dataadapter.repository.model.entity; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + import java.io.Serializable; import java.util.Date; diff --git a/powerauth-data-adapter/src/main/resources/application.properties b/powerauth-data-adapter/src/main/resources/application.properties index b2e2b1f6..8de28089 100644 --- a/powerauth-data-adapter/src/main/resources/application.properties +++ b/powerauth-data-adapter/src/main/resources/application.properties @@ -8,7 +8,6 @@ spring.datasource.password= spring.datasource.hikari.auto-commit=false spring.datasource.driver-class-name=org.postgresql.Driver spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect -spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false spring.jpa.properties.hibernate.connection.characterEncoding=utf8 spring.jpa.properties.hibernate.connection.useUnicode=true @@ -18,15 +17,6 @@ spring.jpa.properties.hibernate.connection.useUnicode=true #spring.datasource.password= #spring.datasource.driver-class-name=oracle.jdbc.OracleDriver # The following property speeds up Spring Boot startup -#spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false - -# Database Configuration - MySQL -#spring.datasource.url=jdbc:mysql://localhost:3306/powerauth -#spring.datasource.username=powerauth -#spring.datasource.password= -#spring.datasource.driver-class-name=com.mysql.jdbc.Driver -#spring.jpa.properties.hibernate.connection.characterEncoding=utf8 -#spring.jpa.properties.hibernate.connection.useUnicode=true # SMS OTP expiration time in seconds powerauth.authorization.sms-otp.expiration-time-in-seconds=300 From aa23acd7a7cd898db0ea0ea59677b9fd543d9504 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Wed, 3 May 2023 10:09:45 +0200 Subject: [PATCH 11/30] Fix #241: Composed "@RequestMapping" variants should be preferred --- .../powerauth/app/dataadapter/controller/AfsController.java | 2 +- .../app/dataadapter/controller/OperationChangeController.java | 4 ++-- .../app/dataadapter/controller/ServiceController.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AfsController.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AfsController.java index 6e2fb56d..974801d0 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AfsController.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/AfsController.java @@ -59,7 +59,7 @@ public AfsController(DataAdapter dataAdapter) { * @throws DataAdapterRemoteException In case communication with remote system fails. * @throws InvalidOperationContextException In case operation context is invalid. */ - @RequestMapping(value = "/execute", method = RequestMethod.POST) + @PostMapping("/execute") public ObjectResponse executeAfsAction(@RequestBody ObjectRequest request) throws DataAdapterRemoteException, InvalidOperationContextException { logger.info("Received executeAfsAction request for user: {}, operation ID: {}", request.getRequestObject().getUserId(), request.getRequestObject().getOperationContext().getId()); diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/OperationChangeController.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/OperationChangeController.java index a4c17d03..d079d3f0 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/OperationChangeController.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/OperationChangeController.java @@ -64,7 +64,7 @@ public OperationChangeController(DataAdapter dataAdapter) { * @throws InvalidOperationContextException In case provided information is not sufficient for creating * the correct implicit login operation. */ - @RequestMapping(value = "/create", method = RequestMethod.POST) + @PostMapping("/create") public ObjectResponse createImplicitLoginOperation(@RequestBody ObjectRequest request) throws DataAdapterRemoteException, InvalidOperationContextException { final CreateImplicitLoginOperationRequest requestObject = request.getRequestObject(); final String clientId = requestObject.getClientId(); @@ -106,7 +106,7 @@ public Response operationChangedNotification(@RequestBody ObjectRequest getPAOperationMapping(@RequestBody ObjectRequest request) throws DataAdapterRemoteException { logger.info("Received getPAOperationMapping request for user: {}, operation ID: {}", request.getRequestObject().getUserId(), request.getRequestObject().getOperationContext().getId()); diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/ServiceController.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/ServiceController.java index 13377134..42250b86 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/ServiceController.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/controller/ServiceController.java @@ -35,7 +35,7 @@ * @author Petr Dvorak, petr@wultra.com */ @RestController -@RequestMapping(value = "/api/service") +@RequestMapping("/api/service") public class ServiceController { private static final Logger logger = LoggerFactory.getLogger(ServiceController.class); From 3f514bec3cc2f693f6c87eba93f79c7918858962 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Wed, 3 May 2023 09:38:08 +0200 Subject: [PATCH 12/30] Fix #237: Review Java Warnings - Mark serialVersionUID by @Serial - Use parametrized class instead of raw once - Enhance switch - Use pattern variable - Remove redundant throws declaration - Replace !isPresent by isEmpty - Fix javadoc --- .../impl/service/DataAdapterService.java | 78 ++++++++----------- .../impl/service/SmsDeliveryService.java | 69 +++++----------- .../AuthMethodRequestValidator.java | 4 +- .../AuthenticationRequestValidator.java | 8 +- .../AuthorizationSmsRequestValidator.java | 2 +- .../CertificateRequestValidator.java | 2 +- .../ConsentFormRequestValidator.java | 4 +- .../model/entity/SmsAuthorizationEntity.java | 2 + .../service/SmsPersistenceService.java | 2 +- 9 files changed, 66 insertions(+), 105 deletions(-) diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/DataAdapterService.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/DataAdapterService.java index 853416df..c828ef7f 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/DataAdapterService.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/DataAdapterService.java @@ -77,7 +77,7 @@ public DataAdapterService(DataAdapterI18NService dataAdapterI18NService, SmsPers } @Override - public UserDetailResponse lookupUser(String username, String organizationId, String clientCertificate, OperationContext operationContext) throws DataAdapterRemoteException, UserNotFoundException { + public UserDetailResponse lookupUser(String username, String organizationId, String clientCertificate, OperationContext operationContext) { // The sample Data Adapter code uses 1:1 mapping of username to user ID. In real implementation the userId usually differs from the username, so translation of username to user ID is required. // If the user does not exist, return null values for user ID and organization ID. // If user account account is blocked, return AccountStatus.NOT_ACTIVE as account status. @@ -94,7 +94,7 @@ public UserDetailResponse lookupUser(String username, String organizationId, Str } @Override - public UserAuthenticationResponse authenticateUser(String userId, String password, AuthenticationContext authenticationContext, String organizationId, OperationContext operationContext) throws DataAdapterRemoteException { + public UserAuthenticationResponse authenticateUser(String userId, String password, AuthenticationContext authenticationContext, String organizationId, OperationContext operationContext) { // Here will be the real authentication - call to the backend providing authentication. // Return a response with UserAuthenticationResult based on the actual authentication result. // The password is optionally encrypted, the authentication context contains information about encryption. @@ -103,17 +103,11 @@ public UserAuthenticationResponse authenticateUser(String userId, String passwor PasswordProtectionType passwordProtection = authenticationContext.getPasswordProtection(); UserAuthenticationResponse authResponse = new UserAuthenticationResponse(); if (passwordProtection == PasswordProtectionType.NO_PROTECTION && "test".equals(password)) { - try { - UserDetailResponse userDetail = fetchUserDetail(userId, organizationId, operationContext); - // The organization needs to be set in response (e.g. client authenticated against RETAIL organization or SME organization). - userDetail.setOrganizationId(organizationId); - authResponse.setAuthenticationResult(UserAuthenticationResult.SUCCEEDED); - return authResponse; - } catch (UserNotFoundException e) { - authResponse.setAuthenticationResult(UserAuthenticationResult.FAILED); - authResponse.setErrorMessage(AUTHENTICATION_FAILED); - return authResponse; - } + UserDetailResponse userDetail = fetchUserDetail(userId, organizationId, operationContext); + // The organization needs to be set in response (e.g. client authenticated against RETAIL organization or SME organization). + userDetail.setOrganizationId(organizationId); + authResponse.setAuthenticationResult(UserAuthenticationResult.SUCCEEDED); + return authResponse; } authResponse.setAuthenticationResult(UserAuthenticationResult.FAILED); authResponse.setErrorMessage(AUTHENTICATION_FAILED); @@ -131,7 +125,7 @@ public UserAuthenticationResponse authenticateUser(String userId, String passwor } @Override - public UserDetailResponse fetchUserDetail(String userId, String organizationId, OperationContext operationContext) throws DataAdapterRemoteException, UserNotFoundException { + public UserDetailResponse fetchUserDetail(String userId, String organizationId, OperationContext operationContext) { // Fetch user details here ... // In case that user is not found, throw a UserNotFoundException. // The operation context may be null in case the method is called outside of an active operation (e.g. OAuth user profile request). @@ -147,14 +141,14 @@ public UserDetailResponse fetchUserDetail(String userId, String organizationId, } @Override - public InitAuthMethodResponse initAuthMethod(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext) throws DataAdapterRemoteException, InvalidOperationContextException { + public InitAuthMethodResponse initAuthMethod(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext) { // Implement logic for initial configuration of authentication methods. // Certificate-based authentication can be enabled and the certificate verification URL can be specified based on operation context. return new InitAuthMethodResponse(CertificateAuthenticationMode.NOT_AVAILABLE); } @Override - public DecorateOperationFormDataResponse decorateFormData(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext) throws DataAdapterRemoteException, UserNotFoundException { + public DecorateOperationFormDataResponse decorateFormData(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext) { String operationName = operationContext.getName(); FormData formData = operationContext.getFormData(); // Fetch bank account list for given user here from the bank backend. @@ -216,16 +210,14 @@ public DecorateOperationFormDataResponse decorateFormData(String userId, String } @Override - public void formDataChangedNotification(String userId, String organizationId, FormDataChange change, OperationContext operationContext) throws DataAdapterRemoteException { + public void formDataChangedNotification(String userId, String organizationId, FormDataChange change, OperationContext operationContext) { String operationId = operationContext.getId(); - if (change instanceof BankAccountChoice) { + if (change instanceof final BankAccountChoice bankAccountChoice) { // Handle bank account choice here (e.g. send notification to bank backend). - BankAccountChoice bankAccountChoice = (BankAccountChoice) change; logger.info("Bank account chosen: {}, operation ID: {}", bankAccountChoice.getBankAccountId(), operationId); return; - } else if (change instanceof AuthMethodChoice) { + } else if (change instanceof final AuthMethodChoice authMethodChoice) { // Handle authorization method choice here (e.g. send notification to bank backend). - AuthMethodChoice authMethodChoice = (AuthMethodChoice) change; logger.info("Authorization method chosen: {}, operation ID: {}", authMethodChoice.getChosenAuthMethod().toString(), operationId); return; } @@ -233,7 +225,7 @@ public void formDataChangedNotification(String userId, String organizationId, Fo } @Override - public CreateImplicitLoginOperationResponse createImplicitLoginOperation(String clientId, String[] scopes) throws DataAdapterRemoteException { + public CreateImplicitLoginOperationResponse createImplicitLoginOperation(String clientId, String[] scopes) { // Make sure there is only one item in scopes if (scopes == null || scopes.length != 1) { return null; @@ -267,7 +259,7 @@ public CreateImplicitLoginOperationResponse createImplicitLoginOperation(String } @Override - public GetPAOperationMappingResponse getPAOperationMapping(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext) throws DataAdapterRemoteException { + public GetPAOperationMappingResponse getPAOperationMapping(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext) { GetPAOperationMappingResponse response = new GetPAOperationMappingResponse(); switch (operationContext.getName()) { @@ -303,14 +295,14 @@ public GetPAOperationMappingResponse getPAOperationMapping(String userId, String } @Override - public void operationChangedNotification(String userId, String organizationId, OperationChange change, OperationContext operationContext) throws DataAdapterRemoteException { + public void operationChangedNotification(String userId, String organizationId, OperationChange change, OperationContext operationContext) { String operationId = operationContext.getId(); // Handle operation change here (e.g. send notification to bank backend). logger.info("Operation changed, status: {}, operation ID: {}", change.toString(), operationId); } @Override - public CreateSmsAuthorizationResponse createAndSendAuthorizationSms(String userId, String organizationId, AccountStatus accountStatus, AuthMethod authMethod, OperationContext operationContext, String lang) throws InvalidOperationContextException, DataAdapterRemoteException { + public CreateSmsAuthorizationResponse createAndSendAuthorizationSms(String userId, String organizationId, AccountStatus accountStatus, AuthMethod authMethod, OperationContext operationContext, String lang) throws InvalidOperationContextException { CreateSmsAuthorizationResponse response = new CreateSmsAuthorizationResponse(); // MessageId is generated as random UUID, it can be overridden to provide a real message identification String messageId = UUID.randomUUID().toString(); @@ -337,7 +329,7 @@ public CreateSmsAuthorizationResponse createAndSendAuthorizationSms(String userI } @Override - public SendAuthorizationSmsResponse sendAuthorizationSms(String userId, String organizationId, AccountStatus accountStatus, AuthMethod authMethod, OperationContext operationContext, String messageId, String authorizationCode, String lang) throws InvalidOperationContextException, DataAdapterRemoteException { + public SendAuthorizationSmsResponse sendAuthorizationSms(String userId, String organizationId, AccountStatus accountStatus, AuthMethod authMethod, OperationContext operationContext, String messageId, String authorizationCode, String lang) throws InvalidOperationContextException { SendAuthorizationSmsResponse response = new SendAuthorizationSmsResponse(); // Message ID is taken from request response.setMessageId(messageId); @@ -357,7 +349,7 @@ public SendAuthorizationSmsResponse sendAuthorizationSms(String userId, String o } @Override - public VerifySmsAuthorizationResponse verifyAuthorizationSms(String userId, String organizationId, AccountStatus accountStatus, String messageId, String authorizationCode, OperationContext operationContext) throws DataAdapterRemoteException, InvalidOperationContextException { + public VerifySmsAuthorizationResponse verifyAuthorizationSms(String userId, String organizationId, AccountStatus accountStatus, String messageId, String authorizationCode, OperationContext operationContext) { // You can override this logic in case more complex handling of SMS verification is required. VerifySmsAuthorizationResponse response; @@ -379,7 +371,7 @@ public VerifySmsAuthorizationResponse verifyAuthorizationSms(String userId, Stri } @Override - public VerifySmsAndPasswordResponse verifyAuthorizationSmsAndPassword(String userId, String organizationId, AccountStatus accountStatus, String messageId, String authorizationCode, OperationContext operationContext, AuthenticationContext authenticationContext, String password) throws DataAdapterRemoteException, InvalidOperationContextException { + public VerifySmsAndPasswordResponse verifyAuthorizationSmsAndPassword(String userId, String organizationId, AccountStatus accountStatus, String messageId, String authorizationCode, OperationContext operationContext, AuthenticationContext authenticationContext, String password) { VerifySmsAndPasswordResponse response = new VerifySmsAndPasswordResponse(); // Skip credentials verification for non-existent user accounts or blocked user accounts, such request would always fail. @@ -414,20 +406,20 @@ public VerifySmsAndPasswordResponse verifyAuthorizationSmsAndPassword(String use } @Override - public VerifyCertificateResponse verifyCertificate(String userId, String organizationId, String certificate, String signedMessage, AuthInstrument authInstrument, AuthMethod authMethod, AccountStatus accountStatus, OperationContext operationContext) throws DataAdapterRemoteException, InvalidOperationContextException { + public VerifyCertificateResponse verifyCertificate(String userId, String organizationId, String certificate, String signedMessage, AuthInstrument authInstrument, AuthMethod authMethod, AccountStatus accountStatus, OperationContext operationContext) { // This method should implement client TLS certificate and/or qualified certificate verification. The stub implementation always succeeds. CertificateVerificationResult verificationResult = CertificateVerificationResult.SUCCEEDED; return new VerifyCertificateResponse(verificationResult); } @Override - public InitConsentFormResponse initConsentForm(String userId, String organizationId, OperationContext operationContext) throws DataAdapterRemoteException, InvalidOperationContextException, InvalidConsentDataException { + public InitConsentFormResponse initConsentForm(String userId, String organizationId, OperationContext operationContext) { // Override this logic in case consent form should be displayed conditionally for given operation context. return new InitConsentFormResponse(true); } @Override - public CreateConsentFormResponse createConsentForm(String userId, String organizationId, OperationContext operationContext, String lang) throws DataAdapterRemoteException, InvalidOperationContextException, InvalidConsentDataException { + public CreateConsentFormResponse createConsentForm(String userId, String organizationId, OperationContext operationContext, String lang) throws InvalidOperationContextException { // Fallback to English for unsupported languages, see: https://github.com/wultra/powerauth-webflow-customization/issues/104 if (!"cs".equals(lang) && !"en".equals(lang)) { lang = "en"; @@ -488,7 +480,7 @@ public CreateConsentFormResponse createConsentForm(String userId, String organiz } @Override - public ValidateConsentFormResponse validateConsentForm(String userId, String organizationId, OperationContext operationContext, String lang, List options) throws DataAdapterRemoteException, InvalidOperationContextException, InvalidConsentDataException { + public ValidateConsentFormResponse validateConsentForm(String userId, String organizationId, OperationContext operationContext, String lang, List options) throws InvalidOperationContextException, InvalidConsentDataException { // Fallback to English for unsupported languages, see: https://github.com/wultra/powerauth-webflow-customization/issues/104 if (!"cs".equals(lang) && !"en".equals(lang)) { lang = "en"; @@ -577,7 +569,7 @@ public ValidateConsentFormResponse validateConsentForm(String userId, String org } @Override - public SaveConsentFormResponse saveConsentForm(String userId, String organizationId, OperationContext operationContext, List options) throws DataAdapterRemoteException, InvalidOperationContextException, InvalidConsentDataException { + public SaveConsentFormResponse saveConsentForm(String userId, String organizationId, OperationContext operationContext, List options) { // Save consent form options selected by the user. The sample implementation only logs the selected options. logger.info("Saving consent form for user: {}, operation ID: {}", userId, operationContext.getId()); for (ConsentOption option: options) { @@ -587,7 +579,7 @@ public SaveConsentFormResponse saveConsentForm(String userId, String organizatio } @Override - public AfsResponse executeAfsAction(String userId, String organizationId, OperationContext operationContext, AfsRequestParameters afsRequestParameters, Map extras) throws DataAdapterRemoteException, InvalidOperationContextException { + public AfsResponse executeAfsAction(String userId, String organizationId, OperationContext operationContext, AfsRequestParameters afsRequestParameters, Map extras) throws InvalidOperationContextException { if (userId == null || organizationId == null || operationContext == null || afsRequestParameters == null || afsRequestParameters.getAfsAction() == null || afsRequestParameters.getAfsType() == null) { logger.warn("Invalid AFS request received"); @@ -598,15 +590,12 @@ public AfsResponse executeAfsAction(String userId, String organizationId, Operat // a mocked response is returned with static 2FA AFS label except for the case of payment with low amount. AfsResponse response = new AfsResponse(); switch (afsRequestParameters.getAfsAction()) { - case LOGIN_INIT: - case LOGIN_AUTH: - case APPROVAL_AUTH: + case LOGIN_INIT, LOGIN_AUTH, APPROVAL_AUTH -> { // Return AFS label, but do not apply response parameters on authentication form response.setAfsResponseApplied(false); response.setAfsLabel("2FA"); - break; - - case APPROVAL_INIT: + } + case APPROVAL_INIT -> { // Apply AFS response parameters on authentication form. // This example performs step-down from 2FA to 1FA in case of payment in CZK with low amount. AmountAttribute amountAttribute = operationValueExtractionService.getAmount(operationContext); @@ -621,13 +610,10 @@ public AfsResponse executeAfsAction(String userId, String organizationId, Operat response.setAfsResponseApplied(false); response.setAfsLabel("2FA"); } - break; - - case LOGOUT: + } + case LOGOUT -> // Do not apply response parameters - response.setAfsResponseApplied(false); - break; - + response.setAfsResponseApplied(false); } return response; } diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/SmsDeliveryService.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/SmsDeliveryService.java index 70c850a7..4412c817 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/SmsDeliveryService.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/SmsDeliveryService.java @@ -15,7 +15,6 @@ */ package io.getlime.security.powerauth.app.dataadapter.impl.service; -import io.getlime.security.powerauth.app.dataadapter.exception.DataAdapterRemoteException; import io.getlime.security.powerauth.app.dataadapter.exception.InvalidOperationContextException; import io.getlime.security.powerauth.app.dataadapter.service.DataAdapterI18NService; import io.getlime.security.powerauth.crypto.server.util.DataDigest; @@ -59,27 +58,16 @@ public SmsDeliveryService(DataAdapterI18NService dataAdapterI18NService, Operati * @param operationContext Operation context. * @return Authorization code. * @throws InvalidOperationContextException Thrown when operation context is invalid. - * @throws DataAdapterRemoteException Thrown when remote communication fails. */ - public AuthorizationCode generateAuthorizationCode(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext) throws InvalidOperationContextException, DataAdapterRemoteException { + public AuthorizationCode generateAuthorizationCode(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext) throws InvalidOperationContextException { String operationName = operationContext.getName(); List digestItems = new ArrayList<>(); switch (operationName) { - case "login": - case "login_sca": - digestItems.add("login"); - break; - - case "authorize_payment": - case "authorize_payment_sca": + case "login", "login_sca" -> digestItems.add("login"); + case "authorize_payment", "authorize_payment_sca" -> { switch (authMethod) { - case LOGIN_SCA: - digestItems.add("login"); - break; - - case APPROVAL_SCA: - case SMS_KEY: - case POWERAUTH_TOKEN: + case LOGIN_SCA -> digestItems.add("login"); + case APPROVAL_SCA, SMS_KEY, POWERAUTH_TOKEN -> { AmountAttribute amountAttribute = operationValueExtractionService.getAmount(operationContext); String account = operationValueExtractionService.getAccount(operationContext); BigDecimal amount = amountAttribute.getAmount(); @@ -87,16 +75,13 @@ public AuthorizationCode generateAuthorizationCode(String userId, String organiz digestItems.add(amount.toPlainString()); digestItems.add(currency); digestItems.add(account); - break; - - default: - throw new InvalidOperationContextException("Unsupported authentication method: " + authMethod); + } + default -> throw new InvalidOperationContextException("Unsupported authentication method: " + authMethod); } - break; + } // Add new operations here. - default: - throw new InvalidOperationContextException("Unsupported operation: " + operationName); + default -> throw new InvalidOperationContextException("Unsupported operation: " + operationName); } final DataDigest.Result digestResult = new DataDigest().generateDigest(digestItems); @@ -115,46 +100,36 @@ public AuthorizationCode generateAuthorizationCode(String userId, String organiz * @param lang Language for localization. * @return Generated SMS text with authorization code. * @throws InvalidOperationContextException Thrown when operation context is invalid. - * @throws DataAdapterRemoteException Thrown when remote communication fails. */ - public String generateSmsText(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext, AuthorizationCode authorizationCode, String lang) throws InvalidOperationContextException, DataAdapterRemoteException { + public String generateSmsText(String userId, String organizationId, AuthMethod authMethod, OperationContext operationContext, AuthorizationCode authorizationCode, String lang) throws InvalidOperationContextException { String operationName = operationContext.getName(); String[] messageArgs; String messageResourcePrefix; switch (operationName) { - case "login": - case "login_sca": + case "login", "login_sca" -> { messageResourcePrefix = "login"; messageArgs = new String[]{authorizationCode.getCode()}; - break; - - case "authorize_payment": - case "authorize_payment_sca": + } + case "authorize_payment", "authorize_payment_sca" -> { switch (authMethod) { - case LOGIN_SCA: + case LOGIN_SCA -> { messageResourcePrefix = "login"; messageArgs = new String[]{authorizationCode.getCode()}; - break; - - case APPROVAL_SCA: - case SMS_KEY: - case POWERAUTH_TOKEN: + } + case APPROVAL_SCA, SMS_KEY, POWERAUTH_TOKEN -> { messageResourcePrefix = "authorize_payment"; AmountAttribute amountAttribute = operationValueExtractionService.getAmount(operationContext); String account = operationValueExtractionService.getAccount(operationContext); BigDecimal amount = amountAttribute.getAmount(); String currency = amountAttribute.getCurrency(); messageArgs = new String[]{amount.toPlainString(), currency, account, authorizationCode.getCode()}; - break; - - default: - throw new InvalidOperationContextException("Unsupported authentication method: " + authMethod); + } + default -> throw new InvalidOperationContextException("Unsupported authentication method: " + authMethod); } - break; + } // Add new operations here. - default: - throw new InvalidOperationContextException("Unsupported operation: " + operationName); + default -> throw new InvalidOperationContextException("Unsupported operation: " + operationName); } return dataAdapterI18NService.messageSource().getMessage(messageResourcePrefix + ".smsText", messageArgs, new Locale(lang)); @@ -167,10 +142,8 @@ public String generateSmsText(String userId, String organizationId, AuthMethod a * @param messageId Message ID. * @param messageText Text of SMS message. * @param operationContext Operation context. - * @throws InvalidOperationContextException Thrown when operation context is invalid. - * @throws DataAdapterRemoteException Thrown when remote communication fails or SMS message could not be delivered. */ - public SmsDeliveryResult sendAuthorizationSms(String userId, String organizationId, String messageId, String messageText, OperationContext operationContext) throws InvalidOperationContextException, DataAdapterRemoteException { + public SmsDeliveryResult sendAuthorizationSms(String userId, String organizationId, String messageId, String messageText, OperationContext operationContext) { // Add here code to send the SMS OTP message to user identified by userId with messageText. // The message entity can be extracted using message ID from table da_sms_authorization. // In case message delivery fails, throw a DataAdapterRemoteException. diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthMethodRequestValidator.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthMethodRequestValidator.java index 20774a46..067f94bc 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthMethodRequestValidator.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthMethodRequestValidator.java @@ -28,7 +28,7 @@ /** * Defines validations for input fields in authentication method requests. - * + *

* Additional validation logic can be added if applicable. * * @author Roman Strobl, roman.strobl@wultra.com @@ -62,7 +62,7 @@ public boolean supports(@NonNull Class clazz) { */ @Override public void validate(@Nullable Object o, @NonNull Errors errors) { - ObjectRequest objectRequest = (ObjectRequest) o; + final ObjectRequest objectRequest = (ObjectRequest) o; if (objectRequest == null) { errors.rejectValue(OPERATION_CONTEXT_FIELD, MISSING_OPERATION_CONTEXT_ERROR_CODE); return; diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthenticationRequestValidator.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthenticationRequestValidator.java index f50c1ba8..ae3025b9 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthenticationRequestValidator.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthenticationRequestValidator.java @@ -30,7 +30,7 @@ /** * Defines validations for input fields in user lookup and authentication requests. - * + *

* Additional validation logic can be added if applicable. * * @author Roman Strobl, roman.strobl@wultra.com @@ -60,7 +60,7 @@ public boolean supports(@NonNull Class clazz) { */ @Override public void validate(@Nullable Object o, @NonNull Errors errors) { - ObjectRequest objectRequest = (ObjectRequest) o; + final ObjectRequest objectRequest = (ObjectRequest) o; if (objectRequest == null) { errors.rejectValue(OPERATION_CONTEXT_FIELD, MISSING_OPERATION_CONTEXT_ERROR_CODE); return; @@ -72,7 +72,7 @@ public void validate(@Nullable Object o, @NonNull Errors errors) { } } - private void validateUserLookupRequest(ObjectRequest objectRequest, Errors errors) { + private void validateUserLookupRequest(ObjectRequest objectRequest, Errors errors) { UserLookupRequest authRequest = (UserLookupRequest) objectRequest.getRequestObject(); // update validation logic based on the real Data Adapter requirements @@ -98,7 +98,7 @@ private void validateUserLookupRequest(ObjectRequest objectRequest, Errors error } } - private void validateUserAuthenticationRequest(ObjectRequest objectRequest, Errors errors) { + private void validateUserAuthenticationRequest(ObjectRequest objectRequest, Errors errors) { UserAuthenticationRequest authRequest = (UserAuthenticationRequest) objectRequest.getRequestObject(); // update validation logic based on the real Data Adapter requirements diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthorizationSmsRequestValidator.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthorizationSmsRequestValidator.java index 3d79e220..f803ce7f 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthorizationSmsRequestValidator.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/AuthorizationSmsRequestValidator.java @@ -34,7 +34,7 @@ /** * Validator for SMS OTP authorization requests. - * + *

* Additional validation logic can be added if applicable. * * @author Roman Strobl, roman.strobl@wultra.com diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/CertificateRequestValidator.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/CertificateRequestValidator.java index 19e5d3e9..9200d0ba 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/CertificateRequestValidator.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/CertificateRequestValidator.java @@ -26,7 +26,7 @@ /** * Validator for certificate verification requests. - * + *

* Additional validation logic can be added if applicable. * * @author Roman Strobl, roman.strobl@wultra.com diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/ConsentFormRequestValidator.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/ConsentFormRequestValidator.java index fb736a5b..8d598cf1 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/ConsentFormRequestValidator.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/validation/ConsentFormRequestValidator.java @@ -33,7 +33,7 @@ /** * Validator for request to create OAuth 2.0 consent form. - * + *

* Additional validation logic can be added if applicable. * * @author Roman Strobl, roman.strobl@wultra.com @@ -61,7 +61,7 @@ public boolean supports(@NonNull Class clazz) { @Override @SuppressWarnings("unchecked") public void validate(@Nullable Object o, @NonNull Errors errors) { - ObjectRequest objectRequest = (ObjectRequest) o; + final ObjectRequest objectRequest = (ObjectRequest) o; if (objectRequest == null) { errors.rejectValue("requestObject.operationContext", "operationContext.missing"); return; diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/repository/model/entity/SmsAuthorizationEntity.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/repository/model/entity/SmsAuthorizationEntity.java index afd2b718..d813dfd2 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/repository/model/entity/SmsAuthorizationEntity.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/repository/model/entity/SmsAuthorizationEntity.java @@ -20,6 +20,7 @@ import jakarta.persistence.Id; import jakarta.persistence.Table; +import java.io.Serial; import java.io.Serializable; import java.util.Date; @@ -32,6 +33,7 @@ @Table(name = "da_sms_authorization") public class SmsAuthorizationEntity implements Serializable { + @Serial private static final long serialVersionUID = 6432269422572862762L; @Id diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/service/SmsPersistenceService.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/service/SmsPersistenceService.java index 27dd93c6..a75ef284 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/service/SmsPersistenceService.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/service/SmsPersistenceService.java @@ -96,7 +96,7 @@ public SmsAuthorizationEntity createAuthorizationSms(String userId, String organ public VerifySmsAuthorizationResponse verifyAuthorizationSms(String messageId, String authorizationCode, boolean allowMultipleVerifications) { Optional smsEntityOptional = smsAuthorizationRepository.findById(messageId); VerifySmsAuthorizationResponse response = new VerifySmsAuthorizationResponse(); - if (!smsEntityOptional.isPresent()) { + if (smsEntityOptional.isEmpty()) { response.setSmsAuthorizationResult(SmsAuthorizationResult.FAILED); response.setErrorMessage("smsAuthorization.invalidMessage"); return response; From d18fb921d1da066a8e8d77fbf816c54cb7e87c9b Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Wed, 3 May 2023 10:02:06 +0200 Subject: [PATCH 13/30] Fix #239: Add PostgreSQL JDBC driver to war --- powerauth-data-adapter/pom.xml | 43 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index e7dd718b..2d98a1e7 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -78,6 +78,10 @@ log4j-to-slf4j org.apache.logging.log4j + + org.springframework.boot + spring-boot-starter-tomcat + @@ -93,10 +97,16 @@ spring-boot-starter-actuator - + - tomcat-embed-websocket - org.apache.tomcat.embed + org.postgresql + postgresql + + + + + jakarta.servlet + jakarta.servlet-api provided @@ -145,6 +155,28 @@ + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-banned-dependencies + + enforce + + + + + + org.apache.tomcat.embed:*:*:*:compile + + + + + + + @@ -203,8 +235,9 @@ standalone - org.postgresql - postgresql + tomcat-embed-websocket + org.apache.tomcat.embed + provided From e89ddbc64761b634e9eeca60718aa403ad8f02ab Mon Sep 17 00:00:00 2001 From: "roman.strobl@wultra.com" Date: Mon, 15 May 2023 09:54:52 +0200 Subject: [PATCH 14/30] Fix #243: Reflect API changes after migration to Java 17 --- .../app/dataadapter/impl/service/SmsDeliveryService.java | 6 +++--- .../app/dataadapter/service/SmsPersistenceService.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/SmsDeliveryService.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/SmsDeliveryService.java index 4412c817..979d6b8f 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/SmsDeliveryService.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/SmsDeliveryService.java @@ -108,13 +108,13 @@ public String generateSmsText(String userId, String organizationId, AuthMethod a switch (operationName) { case "login", "login_sca" -> { messageResourcePrefix = "login"; - messageArgs = new String[]{authorizationCode.getCode()}; + messageArgs = new String[]{authorizationCode.code()}; } case "authorize_payment", "authorize_payment_sca" -> { switch (authMethod) { case LOGIN_SCA -> { messageResourcePrefix = "login"; - messageArgs = new String[]{authorizationCode.getCode()}; + messageArgs = new String[]{authorizationCode.code()}; } case APPROVAL_SCA, SMS_KEY, POWERAUTH_TOKEN -> { messageResourcePrefix = "authorize_payment"; @@ -122,7 +122,7 @@ public String generateSmsText(String userId, String organizationId, AuthMethod a String account = operationValueExtractionService.getAccount(operationContext); BigDecimal amount = amountAttribute.getAmount(); String currency = amountAttribute.getCurrency(); - messageArgs = new String[]{amount.toPlainString(), currency, account, authorizationCode.getCode()}; + messageArgs = new String[]{amount.toPlainString(), currency, account, authorizationCode.code()}; } default -> throw new InvalidOperationContextException("Unsupported authentication method: " + authMethod); } diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/service/SmsPersistenceService.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/service/SmsPersistenceService.java index a75ef284..98e6295a 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/service/SmsPersistenceService.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/service/SmsPersistenceService.java @@ -70,8 +70,8 @@ public SmsAuthorizationEntity createAuthorizationSms(String userId, String organ smsEntity.setUserId(userId); smsEntity.setOrganizationId(organizationId); smsEntity.setOperationName(operationContext.getName()); - smsEntity.setAuthorizationCode(authorizationCode.getCode()); - smsEntity.setSalt(authorizationCode.getSalt()); + smsEntity.setAuthorizationCode(authorizationCode.code()); + smsEntity.setSalt(authorizationCode.salt()); smsEntity.setMessageText(messageText); smsEntity.setVerifyRequestCount(0); smsEntity.setTimestampCreated(new Date()); From dfa24325cc14b5d11ed0b9fe8b0a648abdcf2cf3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:12:54 +0000 Subject: [PATCH 15/30] Bump spring-boot-starter-parent in /powerauth-data-adapter Bumps [spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.0.6 to 3.1.0. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.0.6...v3.1.0) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-starter-parent dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 2d98a1e7..8cc11964 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 3.0.6 + 3.1.0 From f4af74b1e004b8a81c5d3a017fda0ca9811e21df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Jun 2023 11:00:49 +0000 Subject: [PATCH 16/30] Bump bcprov-jdk18on from 1.73 to 1.74 in /powerauth-data-adapter Bumps [bcprov-jdk18on](https://github.com/bcgit/bc-java) from 1.73 to 1.74. - [Changelog](https://github.com/bcgit/bc-java/blob/main/docs/releasenotes.html) - [Commits](https://github.com/bcgit/bc-java/commits) --- updated-dependencies: - dependency-name: org.bouncycastle:bcprov-jdk18on dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 8cc11964..e23ee05b 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -130,7 +130,7 @@ org.bouncycastle bcprov-jdk18on - 1.73 + 1.74 From 7f742a62ddaf6918a250eb0bed5a9df6a39f596c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 11:02:18 +0000 Subject: [PATCH 17/30] Bump bcprov-jdk18on from 1.74 to 1.75 in /powerauth-data-adapter Bumps [bcprov-jdk18on](https://github.com/bcgit/bc-java) from 1.74 to 1.75. - [Changelog](https://github.com/bcgit/bc-java/blob/main/docs/releasenotes.html) - [Commits](https://github.com/bcgit/bc-java/commits) --- updated-dependencies: - dependency-name: org.bouncycastle:bcprov-jdk18on dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index e23ee05b..d5d78eca 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -130,7 +130,7 @@ org.bouncycastle bcprov-jdk18on - 1.74 + 1.75 From f7ad4ed17c16303deeec54053a2c413f23a12bd5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 11:02:27 +0000 Subject: [PATCH 18/30] Bump spring-boot-starter-parent in /powerauth-data-adapter Bumps [spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.1.0...v3.1.1) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-starter-parent dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index e23ee05b..0712d61b 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.0 + 3.1.1 From d5493a9ef54afa5b8dc6915c6ba3a2c4b5bd32b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 05:56:07 +0000 Subject: [PATCH 19/30] Bump org.springframework.boot:spring-boot-starter-parent Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.1.1 to 3.1.2. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.1.1...v3.1.2) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-starter-parent dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 734401ee..f3379869 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.1 + 3.1.2 From b512909a71acc3a2ac02d2d3e1bb00ecf4877a67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 10:08:39 +0000 Subject: [PATCH 20/30] Bump org.bouncycastle:bcprov-jdk18on in /powerauth-data-adapter Bumps [org.bouncycastle:bcprov-jdk18on](https://github.com/bcgit/bc-java) from 1.75 to 1.76. - [Changelog](https://github.com/bcgit/bc-java/blob/main/docs/releasenotes.html) - [Commits](https://github.com/bcgit/bc-java/commits) --- updated-dependencies: - dependency-name: org.bouncycastle:bcprov-jdk18on dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index f3379869..526ff87c 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -130,7 +130,7 @@ org.bouncycastle bcprov-jdk18on - 1.75 + 1.76 From e9dbe0136c9b5dc5ab364e0d514845d294b839c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 10:32:21 +0000 Subject: [PATCH 21/30] Bump org.springdoc:springdoc-openapi-starter-webmvc-ui Bumps [org.springdoc:springdoc-openapi-starter-webmvc-ui](https://github.com/springdoc/springdoc-openapi) from 2.1.0 to 2.2.0. - [Release notes](https://github.com/springdoc/springdoc-openapi/releases) - [Changelog](https://github.com/springdoc/springdoc-openapi/blob/main/CHANGELOG.md) - [Commits](https://github.com/springdoc/springdoc-openapi/compare/v2.1.0...v2.2.0) --- updated-dependencies: - dependency-name: org.springdoc:springdoc-openapi-starter-webmvc-ui dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 526ff87c..7168a884 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -62,7 +62,7 @@ - 2.1.0 + 2.2.0 1.5.0-SNAPSHOT 1.5.0-SNAPSHOT From 39be917b3bbd5c7270824885b8015d74047b0235 Mon Sep 17 00:00:00 2001 From: Jan Dusil <134381434+jandusil@users.noreply.github.com> Date: Fri, 18 Aug 2023 16:25:00 +0200 Subject: [PATCH 22/30] Fix #252: Add CodeQL Analysis (#253) - Add codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 76 +++++---------------------- 1 file changed, 12 insertions(+), 64 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 64753c87..c502bf2b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,74 +1,22 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# name: "CodeQL" on: + workflow_dispatch: push: - branches: [ develop, master ] + branches: [ 'develop', 'master', 'releases/**' ] pull_request: # The branches below must be a subset of the branches above - branches: [ develop ] + branches: [ 'develop', 'master', 'releases/**' ] schedule: - cron: '19 8 * * 5' jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'java' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'temurin' - cache: maven - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + codeql-analysis: + uses: wultra/wultra-infrastructure/.github/workflows/codeql-analysis.yml@develop + secrets: inherit + with: + languages: "['java']" + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support \ No newline at end of file From 5aa22ecd475b39f049de766bbf31b3ac91bb84d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Aug 2023 10:08:21 +0000 Subject: [PATCH 23/30] Bump org.springframework.boot:spring-boot-starter-parent Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.1.2 to 3.1.3. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.1.2...v3.1.3) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-starter-parent dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 7168a884..815d0448 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.2 + 3.1.3 From ccf47b24cd0f1718f2e20e9c3dc6b9a1b8ee419b Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Tue, 5 Sep 2023 10:25:14 +0200 Subject: [PATCH 24/30] Fix #258: Set release version to 1.5.0 --- powerauth-data-adapter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 815d0448..177fbd27 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -5,7 +5,7 @@ powerauth-data-adapter io.getlime.security - 1.5.0-SNAPSHOT + 1.5.0 war powerauth-data-adapter From a412b63a233bd20eef56d398e2ef0c0b967fb066 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Tue, 5 Sep 2023 10:31:56 +0200 Subject: [PATCH 25/30] Fix #260: Add liquibase tag 1.5.0 --- .../1.5.x/20230905-add-tag-1.5.0.xml | 10 ++++++++++ .../1.5.x/db.changelog-version.xml | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/20230905-add-tag-1.5.0.xml diff --git a/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/20230905-add-tag-1.5.0.xml b/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/20230905-add-tag-1.5.0.xml new file mode 100644 index 00000000..3e2e54a5 --- /dev/null +++ b/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/20230905-add-tag-1.5.0.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/db.changelog-version.xml b/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/db.changelog-version.xml index 6645fa83..b571e45e 100644 --- a/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/db.changelog-version.xml +++ b/docs/db/changelog/changesets/powerauth-data-adapter/1.5.x/db.changelog-version.xml @@ -3,4 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd"> + + \ No newline at end of file From 31948d46cb2f8a2fc12655041c0639f4c360578b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Ra=C4=8Dansk=C3=BD?= Date: Wed, 13 Sep 2023 13:18:50 +0200 Subject: [PATCH 26/30] Fix #263: Register BC provider for standalone (#264) * Fix #263: Register BC provider for standalone --- .../powerauth/app/dataadapter/DataAdapterApplication.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/DataAdapterApplication.java b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/DataAdapterApplication.java index c3d0672c..d0ce0c86 100644 --- a/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/DataAdapterApplication.java +++ b/powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/DataAdapterApplication.java @@ -15,9 +15,12 @@ */ package io.getlime.security.powerauth.app.dataadapter; +import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import java.security.Security; + /** * Spring Boot application main class. * @author Roman Strobl, roman.strobl@wultra.com @@ -26,6 +29,7 @@ public class DataAdapterApplication { public static void main(String[] args) { + Security.addProvider(new BouncyCastleProvider()); SpringApplication.run(DataAdapterApplication.class, args); } } From 6601e1afcc8a8995fd139b27b16a0922cb8b20d8 Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Thu, 14 Sep 2023 07:17:51 +0200 Subject: [PATCH 27/30] Fix #265: Default datasource should use schema powerauth --- .../src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/src/main/resources/application.properties b/powerauth-data-adapter/src/main/resources/application.properties index 8de28089..f454890e 100644 --- a/powerauth-data-adapter/src/main/resources/application.properties +++ b/powerauth-data-adapter/src/main/resources/application.properties @@ -2,7 +2,7 @@ spring.profiles.active=ext # Database Configuration - PostgreSQL -spring.datasource.url=jdbc:postgresql://localhost:5432/postgres +spring.datasource.url=jdbc:postgresql://localhost:5432/powerauth spring.datasource.username=powerauth spring.datasource.password= spring.datasource.hikari.auto-commit=false From 18a80bbe613ee4fee779ac5acd2ccd7de6f80f6e Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Tue, 3 Oct 2023 14:00:03 +0200 Subject: [PATCH 28/30] Fix #268: Add logstash-logback-encoder dependency --- powerauth-data-adapter/pom.xml | 8 ++++++++ .../src/main/resources/application.properties | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 815d0448..7a19a5ed 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -63,6 +63,7 @@ 2.2.0 + 7.4 1.5.0-SNAPSHOT 1.5.0-SNAPSHOT @@ -133,6 +134,13 @@ 1.76 + + + net.logstash.logback + logstash-logback-encoder + ${logstash.version} + + org.springdoc diff --git a/powerauth-data-adapter/src/main/resources/application.properties b/powerauth-data-adapter/src/main/resources/application.properties index f454890e..4d00f3d4 100644 --- a/powerauth-data-adapter/src/main/resources/application.properties +++ b/powerauth-data-adapter/src/main/resources/application.properties @@ -35,4 +35,6 @@ powerauth.dataAdapter.service.applicationEnvironment= spring.jpa.open-in-view=false # Disable swagger-ui default petstore url -springdoc.swagger-ui.disable-swagger-default-url=true \ No newline at end of file +springdoc.swagger-ui.disable-swagger-default-url=true + +logging.config=${POWERAUTH_DATA_ADAPTER_LOGGING:} From 9ea92cf322e3f9e2aa556f28b7e8f1188298e29a Mon Sep 17 00:00:00 2001 From: Lubos Racansky Date: Wed, 4 Oct 2023 08:04:37 +0200 Subject: [PATCH 29/30] Fix #270: Wrong bouncycastle version in jboss deployment --- .../src/main/webapp/WEB-INF/jboss-deployment-structure.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerauth-data-adapter/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/powerauth-data-adapter/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index 82d5a46a..0d258a38 100644 --- a/powerauth-data-adapter/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/powerauth-data-adapter/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -12,7 +12,7 @@ - + From c26654d0b277755d829183768c7a3420a4e842ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Ra=C4=8Dansk=C3=BD?= Date: Fri, 6 Oct 2023 07:07:38 +0200 Subject: [PATCH 30/30] Fix #255: Update Wultra dependencies (#256) * Fix #255: Update Wultra dependencies --- powerauth-data-adapter/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/powerauth-data-adapter/pom.xml b/powerauth-data-adapter/pom.xml index 7a19a5ed..7d42a241 100644 --- a/powerauth-data-adapter/pom.xml +++ b/powerauth-data-adapter/pom.xml @@ -65,8 +65,8 @@ 2.2.0 7.4 - 1.5.0-SNAPSHOT - 1.5.0-SNAPSHOT + 1.5.1 + 1.5.0