diff --git a/.github/workflows/db-test.yml b/.github/workflows/db-test.yml new file mode 100644 index 00000000000..430c25da0de --- /dev/null +++ b/.github/workflows/db-test.yml @@ -0,0 +1,39 @@ +name: PostgreSQL Test + +on: + release: + types: [published] + pull_request: + types: [opened, reopened, synchronize] + paths: + - 'db_scripts/**' + workflow_dispatch: + inputs: + message: + description: 'Message for manually triggering' + required: false + default: 'Triggered for Updates' + type: string + push: + branches: + - '!release-branch' + - release* + - master + - 1.* + - develop* + - MOSIP* + paths: + - 'db_scripts/**' + +jobs: + build-db-test: + strategy: + matrix: + include: + - DB_LOCATION: 'db_scripts/mosip_pms' + DB_NAME: 'mosip_pms' + fail-fast: false + name: ${{ matrix.DB_NAME }} + uses: mosip/kattu/.github/workflows/db-test.yml@master + with: + DB_LOCATION: ${{ matrix.DB_LOCATION}} diff --git a/.github/workflows/mavenpublish.yml b/.github/workflows/mavenpublish.yml deleted file mode 100644 index 331c817d32e..00000000000 --- a/.github/workflows/mavenpublish.yml +++ /dev/null @@ -1,214 +0,0 @@ -# This workflow will build a package using Maven and then publish it nexus when a pull request is merged -# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path - -name: Maven Package upon a pull request - -on: - pull_request: - types: [closed] - -jobs: - build: - - runs-on: ubuntu-latest - if: github.event.pull_request.merged == true - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Setup branch and GPG public key - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - echo "::set-env name=GPG_TTY::$(tty)" - echo ${{ env.GPG_TTY }} - sudo apt-get --yes install gnupg2 - gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg - gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Setup the settings file for ossrh server - run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false " > $GITHUB_WORKSPACE/settings.xml - - - name: Build with Maven - run: | - cd partner - mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml - - - name: Ready the springboot artifacts - run: find -name '*.jar' -executable -type f -exec zip release.zip {} + - - - name: Upload the springboot jars - uses: actions/upload-artifact@v1 - with: - name: release - path: ./release.zip - - - publish_to_nexus: - - runs-on: ubuntu-latest - if: github.event.pull_request.merged == true - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Setup branch and GPG public key - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - echo "::set-env name=GPG_TTY::$(tty)" - echo ${{ env.GPG_TTY }} - sudo apt-get --yes install gnupg2 - gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg - gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Setup the settings file for ossrh server - run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false " > $GITHUB_WORKSPACE/settings.xml - - - name: Install xmllint - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - - - name: Build with Maven - run: cd partner && mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml - - - name: Publish the maven package - run: | - chmod +x ./deploy.sh - ./deploy.sh partner $GITHUB_WORKSPACE/settings.xml SNAPSHOT - env: - GPG_TTY: $(tty) - - docker-policy-management-service: - needs: build - - runs-on: ubuntu-latest - env: - NAMESPACE: mosipdev - SERVICE_NAME: policy-management-service - SERVICE_LOCATION: partner/policy-management-service - - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 - with: - name: release - path: ./ - - - name: Setup branch name - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - - - name: Get version info from pom - id: getPomVersion - uses: mavrosxristoforos/get-xml-info@1.0 - with: - xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml - xpath: /*[local-name()="project"]/*[local-name()="version"] - - - name: Unzip and extract the policy-management-service - run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target" - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo "push version ${{steps.getPomVersion.outputs.info}}" - VERSION=$BRANCH_NAME - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - docker-partner-management-service: - needs: build - - runs-on: ubuntu-latest - env: - NAMESPACE: mosipdev - SERVICE_NAME: partner-management-service - SERVICE_LOCATION: partner/partner-management-service - - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 - with: - name: release - path: ./ - - - name: Setup branch name - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - - - name: Get version info from pom - id: getPomVersion - uses: mavrosxristoforos/get-xml-info@1.0 - with: - xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml - xpath: /*[local-name()="project"]/*[local-name()="version"] - - - name: Unzip and extract the partner-management-service - run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target" - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo "push version ${{steps.getPomVersion.outputs.info}}" - VERSION=$BRANCH_NAME - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION \ No newline at end of file diff --git a/.github/workflows/postgres-init_trigger.yml b/.github/workflows/postgres-init_trigger.yml deleted file mode 100644 index 3de4c6f32c5..00000000000 --- a/.github/workflows/postgres-init_trigger.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Trigger postgres-init repo upon db scripts updates - -on: - push: - branches: - - master - - 1.* - - develop - - release* - paths: - - db_release_scripts/** - - db_scripts/** - -jobs: - paths-filter: - runs-on: ubuntu-latest - outputs: - db_release_scripts: ${{ steps.filter.outputs.db_release_scripts }} - db_scripts: ${{ steps.filter.outputs.db_scripts }} - steps: - - uses: actions/checkout@v2 - - uses: dorny/paths-filter@v2 - id: filter - with: - base: ${{ github.ref }} - filters: | - db_release_scripts: - - 'db_release_scripts/**' - db_scripts: - - 'db_scripts/**' - - # run only if 'db_release_scripts' files were changed - db_release_scripts_updates: - needs: paths-filter - if: needs.paths-filter.outputs.db_release_scripts == 'true' - runs-on: ubuntu-latest - steps: - - name: Check for updates - run: echo "Updates are present in db_release_scripts directory, Triggering postgres-init repo" - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,author,job,took,ref # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }} # required - if: success() # Pick up events when the job is successful. - - # run only if not 'db_release_scripts' files were changed - - name: Check for no updates - if: needs.paths-filter.outputs.db_release_scripts != 'true' - run: echo "Updates are not present in db_release_scripts directory" - - # run only if 'db_scripts' files were changed - db_scripts_updates: - needs: paths-filter - if: needs.paths-filter.outputs.db_scripts == 'true' - runs-on: ubuntu-latest - steps: - - name: Check for updates - run: echo "Updates are present in db_scripts directory, Triggering postgres-init repo" - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,author,job,took,ref # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }} # required - if: success() # Pick up events when the job is successful. - - # run only if not 'db_scripts' files were changed - - name: Check for no updates - if: needs.paths-filter.outputs.db_scripts != 'true' - run: echo "Updates are not present in db_scripts directory" - - # This job is to trigger postgres-init repo. - trigger-postgres_init_repo: - runs-on: ubuntu-latest - steps: - - uses: peter-evans/repository-dispatch@v2 - with: - token: ${{ secrets.ACTION_PAT }} - repository: mosip/postgres-init - base: ${{ github.ref }} - event-type: db-event diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml new file mode 100644 index 00000000000..db27b6a7455 --- /dev/null +++ b/.github/workflows/push-trigger.yml @@ -0,0 +1,88 @@ +name: Maven Package upon a push + +on: + release: + types: [published] + pull_request: + types: [opened] + workflow_dispatch: + inputs: + message: + description: 'Message for manually triggering' + required: false + default: 'Triggered for Updates' + type: string + push: + branches: + - '!release-branch' + - release* + - master + - 1.* + - develop + - MOSIP* + +jobs: + build-maven-partner: + uses: mosip/kattu/.github/workflows/maven-build.yml@master + with: + SERVICE_LOCATION: ./partner + BUILD_ARTIFACT: partner + secrets: + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + GPG_SECRET: ${{ secrets.GPG_SECRET }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + publish_to_nexus: + if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}" + needs: build-maven-partner + uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master + with: + SERVICE_LOCATION: ./partner + secrets: + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} + OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + GPG_SECRET: ${{ secrets.GPG_SECRET }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + build-dockers: + needs: build-maven-partner + strategy: + matrix: + include: + - SERVICE_LOCATION: 'partner/partner-management-service' + SERVICE_NAME: 'partner-management-service' + BUILD_ARTIFACT: 'partner' + - SERVICE_LOCATION: 'partner/policy-management-service' + SERVICE_NAME: 'policy-management-service' + BUILD_ARTIFACT: 'partner' + fail-fast: false + name: ${{ matrix.SERVICE_NAME }} + uses: mosip/kattu/.github/workflows/docker-build.yml@master + with: + SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} + SERVICE_NAME: ${{ matrix.SERVICE_NAME }} + BUILD_ARTIFACT: ${{ matrix.BUILD_ARTIFACT }} + secrets: + DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} + ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} + RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + sonar_analysis: + needs: build-maven-partner + if: "${{ github.event_name != 'pull_request' }}" + uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master + with: + SERVICE_LOCATION: ./partner + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + ORG_KEY: ${{ secrets.ORG_KEY }} + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + GPG_SECRET: ${{ secrets.GPG_SECRET }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file diff --git a/.github/workflows/push_trigger.yml b/.github/workflows/push_trigger.yml deleted file mode 100644 index d2a76d7f9e1..00000000000 --- a/.github/workflows/push_trigger.yml +++ /dev/null @@ -1,311 +0,0 @@ -name: Maven Package upon a push - -on: - push: - branches: - - '!release-branch' - - release-1* - - master - - 1.* - - develop - -jobs: - build: - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - - - name: Setup branch and GPG public key - run: | - # Strip git ref prefix from version - - echo ${{ env.BRANCH_NAME }} - echo ${{ env.GPG_TTY }} - sudo apt-get --yes install gnupg2 - gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg - gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Setup the settings file for ossrh server - run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false sonar . https://sonarcloud.io false " > $GITHUB_WORKSPACE/settings.xml - - - name: Build with Maven - run: | - cd partner - mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml - - - name: Ready the springboot artifacts - run: find -name '*.jar' -executable -type f -exec zip release.zip {} + - - - name: Upload the springboot jars - uses: actions/upload-artifact@v1 - with: - name: release - path: ./release.zip - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,workflow,job # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required - if: failure() # Pick up events even if the job fails or is canceled. - - publish_to_nexus: - if: "!contains(github.ref, 'master')" - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - - - name: Setup branch and GPG public key - run: | - # Strip git ref prefix from version - echo ${{ env.BRANCH_NAME }} - echo ${{ env.GPG_TTY }} - sudo apt-get --yes install gnupg2 - gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg - gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Setup the settings file for ossrh server - run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false " > $GITHUB_WORKSPACE/settings.xml - - - name: Install xmllint - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - - name: Build with Maven - run: cd partner && mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml - - - name: Publish the maven package - run: | - chmod +x ./deploy.sh - cd partner && mvn deploy -s $GITHUB_WORKSPACE/settings.xml -f pom.xml - env: - GPG_TTY: $(tty) - # - uses: 8398a7/action-slack@v3 - # with: - # status: ${{ job.status }} - # fields: repo,message,commit,workflow,job # selectable (default: repo,message) - # env: - # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required - # if: failure() # Pick up events even if the job fails or is canceled.D - - docker-policy-management-service: - needs: build - - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets.dev_namespace_docker_hub }} - SERVICE_NAME: policy-management-service - SERVICE_LOCATION: partner/policy-management-service - - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 - with: - name: release - path: ./ - - - name: Setup branch name - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo ${{ env.BRANCH_NAME }} - - - name: Get version info from pom - id: getPomVersion - uses: mavrosxristoforos/get-xml-info@1.0 - with: - xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml - xpath: /*[local-name()="project"]/*[local-name()="version"] - - - name: Unzip and extract the policy-management-service - run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target" - - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --build-arg SOURCE=mosip --build-arg COMMIT_HASH=$(git rev-parse HEAD) --build-arg COMMIT_ID=$(git rev-parse --short HEAD) --build-arg BUILD_TIME=${{steps.date.outputs.date}} --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo "push version ${{steps.getPomVersion.outputs.info}}" - if [[ $BRANCH_NAME == master ]]; then - VERSION=latest - else - VERSION=$BRANCH_NAME - fi - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,workflow,job # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required - if: failure() # Pick up events even if the job fails or is canceled. - - docker-partner-management-service: - needs: build - - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets.dev_namespace_docker_hub }} - SERVICE_NAME: partner-management-service - SERVICE_LOCATION: partner/partner-management-service - - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 - with: - name: release - path: ./ - - - name: Setup branch name - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo ${{ env.BRANCH_NAME }} - - - name: Get version info from pom - id: getPomVersion - uses: mavrosxristoforos/get-xml-info@1.0 - with: - xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml - xpath: /*[local-name()="project"]/*[local-name()="version"] - - - name: Unzip and extract the partner-management-service - run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target" - - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --build-arg SOURCE=mosip --build-arg COMMIT_HASH=$(git rev-parse HEAD) --build-arg COMMIT_ID=$(git rev-parse --short HEAD) --build-arg BUILD_TIME=${{steps.date.outputs.date}} --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo "push version ${{steps.getPomVersion.outputs.info}}" - if [[ $BRANCH_NAME == master ]]; then - VERSION=latest - else - VERSION=$BRANCH_NAME - fi - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,workflow,job # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required - if: failure() # Pick up events even if the job fails or is canceled. - sonar_analysis: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Setup the settings file for ossrh server - run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false sonar . https://sonarcloud.io false " > $GITHUB_WORKSPACE/settings.xml - - - name: Build with Maven - run: | - cd partner - mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml - - - name: Analyze with SonarCloud - run: | - cd partner - mvn -B -Dgpg.skip verify sonar:sonar -Dsonar.projectKey=mosip_${{ github.event.repository.name }} -Dsonar.organization=${{ secrets.ORG_KEY }} -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - - diff --git a/.github/workflows/release-changes.yml b/.github/workflows/release-changes.yml new file mode 100644 index 00000000000..783d4896a2a --- /dev/null +++ b/.github/workflows/release-changes.yml @@ -0,0 +1,29 @@ +name: Release/pre-release Preparation. + +on: + workflow_dispatch: + inputs: + MESSAGE: + description: 'Triggered for release or pe-release' + required: false + default: 'Release Preparation' + RELEASE_TAG: + description: 'tag to update' + required: true + SNAPSHOT_TAG: + description: 'tag to be replaced' + required: true + BASE: + description: 'base branch for PR' + required: true +jobs: + maven-release-preparation: + uses: mosip/kattu/.github/workflows/release-changes.yml@master + with: + MESSAGE: ${{ inputs.MESSAGE }} + RELEASE_TAG: ${{ inputs.RELEASE_TAG }} + SNAPSHOT_TAG: ${{ inputs.SNAPSHOT_TAG }} + BASE: ${{ inputs.BASE }} + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + ACTION_PAT: ${{ secrets.ACTION_PAT }} \ No newline at end of file diff --git a/.github/workflows/release_changes.yml b/.github/workflows/release_changes.yml deleted file mode 100644 index cc9c2956d9e..00000000000 --- a/.github/workflows/release_changes.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Release/pre-release Preparation. - -on: - workflow_dispatch: - inputs: - message: - description: 'Triggered for release or pe-release' - required: false - default: 'Release Preparation' - releaseTags: - description: 'tag to update' - required: true - snapshotTags: - description: 'tag to be replaced' - required: true - base: - description: 'base branch for PR' - required: true -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - - - name: Mannualy changing the pom versions - run: find . -type f -name "*pom.xml" -print0 | xargs -0 sed -i "s/${{ github.event.inputs.snapshotTags }}/${{ github.event.inputs.releaseTags }}/g" - - - name: Updating the Release URL in POM - run: | - cd .github/workflows - sed -i 's/OSSRH_SNAPSHOT_URL/RELEASE_URL/g' push_trigger.yml - - - name: Updating libs-snapshot-local to libs-release local for artifactory URL's. - run: find . -type f -name "*Dockerfile" -print0 | xargs -0 sed -i "s/libs-snapshot-local/libs-release-local/g" - - - name: removing -DskipTests - run: find . -type f -name "*push_trigger.yml" -print0 | xargs -0 sed -i "s/"-DskipTests"//g" - -# - name: removing --Dgpg.skip -# run: find . -type f -name "*push_trigger.yml" -print0 | xargs -0 sed -i "s/"-Dgpg.skip"//g" - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.ACTION_PAT }} - commit-message: Updated Pom versions for release changes - title: Release changes - body: Automated PR for ${{ github.event.inputs.releaseTags }} release. - branch: release-branch - delete-branch: true - base: ${{ github.event.inputs.base }} diff --git a/.github/workflows/release_trigger.yml b/.github/workflows/release_trigger.yml deleted file mode 100644 index 16c505237f2..00000000000 --- a/.github/workflows/release_trigger.yml +++ /dev/null @@ -1,209 +0,0 @@ -name: Release maven packages and docker upon a release - -on: - release: - types: [published] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Setup branch and GPG public key - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - echo "::set-env name=GPG_TTY::$(tty)" - echo ${{ env.GPG_TTY }} - sudo apt-get --yes install gnupg2 - gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg - gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Setup the settings file for ossrh server - run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false " > $GITHUB_WORKSPACE/settings.xml - - - name: Build with Maven - run: | - cd partner - mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml - - - name: Ready the springboot artifacts - run: find -name '*.jar' -executable -type f -exec zip release.zip {} + - - - name: Upload the springboot jars - uses: actions/upload-artifact@v1 - with: - name: release - path: ./release.zip - - - publish_to_nexus: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Setup branch and GPG public key - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - echo "::set-env name=GPG_TTY::$(tty)" - echo ${{ env.GPG_TTY }} - sudo apt-get --yes install gnupg2 - gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg - gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Setup the settings file for ossrh server - run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false " > $GITHUB_WORKSPACE/settings.xml - - - name: Install xmllint - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - - - name: Build with Maven - run: cd partner && mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml - - - name: Publish the maven package - run: | - chmod +x ./deploy.sh - ./deploy.sh partner $GITHUB_WORKSPACE/settings.xml .* - env: - GPG_TTY: $(tty) - - docker-policy-management-service: - needs: build - - runs-on: ubuntu-latest - env: - NAMESPACE: mosipdev - SERVICE_NAME: policy-management-service - SERVICE_LOCATION: partner/policy-management-service - - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 - with: - name: release - path: ./ - - - name: Setup branch name - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - - - name: Get version info from pom - id: getPomVersion - uses: mavrosxristoforos/get-xml-info@1.0 - with: - xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml - xpath: /*[local-name()="project"]/*[local-name()="version"] - - - name: Unzip and extract the policy-management-service - run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target" - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo "push version ${{steps.getPomVersion.outputs.info}}" - VERSION=$BRANCH_NAME - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - docker-partner-management-service: - needs: build - - runs-on: ubuntu-latest - env: - NAMESPACE: mosipdev - SERVICE_NAME: partner-management-service - SERVICE_LOCATION: partner/partner-management-service - - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 - with: - name: release - path: ./ - - - name: Setup branch name - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - - - name: Get version info from pom - id: getPomVersion - uses: mavrosxristoforos/get-xml-info@1.0 - with: - xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml - xpath: /*[local-name()="project"]/*[local-name()="version"] - - - name: Unzip and extract the partner-management-service - run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target" - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo "push version ${{steps.getPomVersion.outputs.info}}" - VERSION=$BRANCH_NAME - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION \ No newline at end of file diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 00000000000..c131f5aa9bb --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,35 @@ +name: Tagging of repos + +on: + workflow_dispatch: + inputs: + TAG: + description: 'Tag to be published' + required: true + type: string + BODY: + description: 'Release body message' + required: true + default: 'Changes in this Release' + type: string + PRE_RELEASE: + description: 'Pre-release? True/False' + required: true + default: False + type: string + DRAFT: + description: 'Draft? True/False' + required: false + default: False + type: string + +jobs: + tag-branch: + uses: mosip/kattu/.github/workflows/tag.yml@master + with: + TAG: ${{ inputs.TAG }} + BODY: ${{ inputs.BODY }} + PRE_RELEASE: ${{ inputs.PRE_RELEASE }} + DRAFT: ${{ inputs.DRAFT }} + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} diff --git a/db_release_scripts/mosip_pms/sql/1.2.0.1-B2_to_1.2.0.1-B3_upgrade.sql b/db_release_scripts/mosip_pms/sql/1.2.0.1-B2_to_1.2.0.1-B3_upgrade.sql new file mode 100644 index 00000000000..0961a3c0164 --- /dev/null +++ b/db_release_scripts/mosip_pms/sql/1.2.0.1-B2_to_1.2.0.1-B3_upgrade.sql @@ -0,0 +1,17 @@ +-- ------------------------------------------------------------------------------------------------- +-- Database Name: mosip_pms +-- Release Version : 1.2.1 +-- Purpose : Database Alter scripts for the release for PMS DB. +-- Create By : Balaji A +-- Created Date : Mar-2023 +-- +-- Modified Date Modified By Comments / Remarks +-- ------------------------------------------------------------------------------------------------- + + + + +\c mosip_pms sysadmin + +INSERT INTO pms.partner_type (code,partner_description,is_policy_required,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes) VALUES + ('Binding_Partner','Binding Partner',true,true,'superadmin',now(),NULL,NULL,false,NULL) ON CONFLICT (code) DO NOTHING; \ No newline at end of file diff --git a/db_release_scripts/mosip_pms/sql/1.2.0.1-B3_to_1.2.0.1-B2_revoke.sql b/db_release_scripts/mosip_pms/sql/1.2.0.1-B3_to_1.2.0.1-B2_revoke.sql new file mode 100644 index 00000000000..163e283db3e --- /dev/null +++ b/db_release_scripts/mosip_pms/sql/1.2.0.1-B3_to_1.2.0.1-B2_revoke.sql @@ -0,0 +1,15 @@ +-- ------------------------------------------------------------------------------------------------- +-- Database Name: mosip_pms +-- Release Version : 1.2.1 +-- Purpose : Revoking Database Alter deployement done for release in PMS DB. +-- Create By : Balaji A +-- Created Date : Mar-2023 +-- +-- Modified Date Modified By Comments / Remarks +-- ------------------------------------------------------------------------------------------------- + + + +\c mosip_pms sysadmin + +DELETE FROM pms.partner_type WHERE code = 'Binding_Partner'; \ No newline at end of file diff --git a/db_release_scripts/mosip_pms/sql/1.2.0.1_to_1.2.0.1-B2_upgrade.sql b/db_release_scripts/mosip_pms/sql/1.2.0.1_to_1.2.0.1-B2_upgrade.sql index 50193732078..4805e0c8294 100644 --- a/db_release_scripts/mosip_pms/sql/1.2.0.1_to_1.2.0.1-B2_upgrade.sql +++ b/db_release_scripts/mosip_pms/sql/1.2.0.1_to_1.2.0.1-B2_upgrade.sql @@ -44,7 +44,7 @@ VALUES('mpolicy-default-digitalcard', 'mpolicygroup-deafult-digitalcard', 'mpoli INSERT INTO pms.auth_policy (id, policy_group_id, "name", descr, policy_file_id, policy_type, "version", policy_schema, valid_from_date, valid_to_date, is_active, cr_by, cr_dtimes, upd_by, upd_dtimes, is_deleted, del_dtimes) -VALUES('mpolicy-default-PDFCard', 'mpolicygroup-deafult-digitalcard', 'string', 'string', '{"shareableAttributes":[{"attributeName":"fullName","source":[{"attribute":"firstName","filter":[{"language":"eng"}]},{"attribute":"middleName","filter":[{"language":"eng"}]},{"attribute":"lastName","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"dateOfBirth","source":[{"attribute":"dateOfBirth"}],"encrypted":false,"format":"YYYY"},{"attributeName":"gender","source":[{"attribute":"gender"}],"encrypted":false},{"attributeName":"phone","source":[{"attribute":"mobileno"}],"encrypted":false},{"attributeName":"email","source":[{"attribute":"email"}],"encrypted":false},{"attributeName":"addressLine1","source":[{"attribute":"permanentAddressLine1"}],"encrypted":false},{"attributeName":"addressLine2","source":[{"attribute":"presentAddressLine1"}],"encrypted":false},{"attributeName":"addressLine3","source":[{"attribute":"addressLine3"}],"encrypted":false},{"attributeName":"province","source":[{"attribute":"presentProvince"},{"attribute":"permanentProvince"}],"encrypted":false},{"attributeName":"city","source":[{"attribute":"permanentCity"},{"attribute":"presentCity"}],"encrypted":false},{"attributeName":"UIN","source":[{"attribute":"UIN"}],"encrypted":false},{"attributeName":"postalCode","source":[{"attribute":"presentZipcode","filter":[{"language":"eng"}]},{"attribute":"permanentZipcode","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"biometrics","group":"CBEFF","source":[{"attribute":"individualBiometrics","filter":[{"type":"Face"}]}],"encrypted":false,"format":"extraction"}],"dataSharePolicies":{"typeOfShare":"direct","validForInMinutes":"30","transactionsAllowed":"2","encryptionType":"Partner Based","shareDomain":"datashare.datashare","source":"ID Repository"}}', 'DataShare', 'string', 'https://schemas.mosip.io/v1/auth-policy', '2020-12-16 12:30:14.183', '2025-04-28 09:37:00.000', true, 'admin', '2020-12-16 12:30:14.183', 'service-account-mosip-creser-client', '2021-02-09 06:50:22.065', false, NULL) ON CONFLICT (id) DO NOTHING; +VALUES('mpolicy-default-PDFCard', 'mpolicygroup-deafult-digitalcard', 'string', 'string', '{"dataSharePolicies":{"typeOfShare":"direct","validForInMinutes":"30","transactionsAllowed":"2","encryptionType":"Partner Based","shareDomain":"datashare.datashare","source":"ID Repository"},"shareableAttributes":[{"attributeName":"fullName","source":[{"attribute":"fullName"}],"encrypted":true},{"attributeName":"dateOfBirth","source":[{"attribute":"dateOfBirth"}],"encrypted":false,"format":"DD/MM/YYYY"},{"attributeName":"gender","source":[{"attribute":"gender"}],"encrypted":false},{"attributeName":"phone","source":[{"attribute":"phone"}],"encrypted":false},{"attributeName":"email","source":[{"attribute":"email"}],"encrypted":false},{"attributeName":"addressLine1","source":[{"attribute":"addressLine1"}],"encrypted":false},{"attributeName":"addressLine2","source":[{"attribute":"addressLine2"}],"encrypted":false},{"attributeName":"addressLine3","source":[{"attribute":"addressLine3"}],"encrypted":false},{"attributeName":"region","source":[{"attribute":"region"}],"encrypted":false},{"attributeName":"province","source":[{"attribute":"province"}],"encrypted":false},{"attributeName":"city","source":[{"attribute":"city"}],"encrypted":false},{"attributeName":"UIN","source":[{"attribute":"UIN"}],"encrypted":false},{"attributeName":"PCN","source":[{"attribute":"VID","filter":[{"type":"PERPETUAL"}]}],"encrypted":false,"format":"RETRIEVE"},{"attributeName":"postalCode","source":[{"attribute":"postalCode"}],"encrypted":false},{"attributeName":"bestTwoFingers","group":"CBEFF","source":[{"attribute":"individualBiometrics","filter":[{"type":"Finger"}]}],"encrypted":false,"format":"bestTwoFingers"},{"attributeName":"biometrics","group":"CBEFF","source":[{"attribute":"individualBiometrics","filter":[{"type":"Face"},{"type":"Finger","subType":["Left Thumb","Right Thumb"]}]}],"encrypted":false,"format":"extraction"}]}', 'DataShare', 'string', 'https://schemas.mosip.io/v1/auth-policy', NOW(), NOW() + INTERVAL '5 year', true, 'admin', NOW(), 'service-account-mosip-creser-client', NULL, false, NULL) ON CONFLICT (id) DO NOTHING; INSERT INTO pms.auth_policy_h (id, eff_dtimes, policy_group_id, "name", descr, policy_file_id, policy_type, "version", policy_schema, valid_from_date, valid_to_date, is_active, cr_by, cr_dtimes, upd_by, upd_dtimes, is_deleted, del_dtimes) diff --git a/db_scripts/mosip_pms/ddl/pms-misp_license.sql b/db_scripts/mosip_pms/ddl/pms-misp_license.sql index e2184526246..0c9b0219dc5 100644 --- a/db_scripts/mosip_pms/ddl/pms-misp_license.sql +++ b/db_scripts/mosip_pms/ddl/pms-misp_license.sql @@ -19,7 +19,7 @@ CREATE TABLE pms.misp_license( misp_id character varying(36) NOT NULL, license_key character varying(128) NOT NULL, - policy_id character varying(128) NULL, + policy_id character varying(36) NULL, valid_from_date timestamp NOT NULL, valid_to_date timestamp, is_active boolean NOT NULL, diff --git a/db_scripts/mosip_pms/ddl/pms-oidc_client.sql b/db_scripts/mosip_pms/ddl/pms-oidc_client.sql index 90d77f5e5b3..dd7ec35e8f7 100644 --- a/db_scripts/mosip_pms/ddl/pms-oidc_client.sql +++ b/db_scripts/mosip_pms/ddl/pms-oidc_client.sql @@ -38,28 +38,27 @@ CREATE TABLE pms.oidc_client( CONSTRAINT uq_oidc_client_public_key UNIQUE (public_key) ); -- ddl-end -- -COMMENT ON TABLE oidc_client.id IS 'Client ID: Unique id assigned to registered OIDC client.'; +COMMENT ON TABLE pms.oidc_client IS 'Client ID: Unique id assigned to registered OIDC client.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.name IS 'Client Name: Registered name of OIDC client.'; +COMMENT ON COLUMN pms.oidc_client.name IS 'Client Name: Registered name of OIDC client.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.logo_uri IS 'Client Logo URL: Client logo to be displayed on IDP UI.'; +COMMENT ON COLUMN pms.oidc_client.logo_uri IS 'Client Logo URL: Client logo to be displayed on IDP UI.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.redirect_uris IS 'Recirect URLS: Comma separated list of client redirect URLs.'; +COMMENT ON COLUMN pms.oidc_client.redirect_uris IS 'Recirect URLS: Comma separated list of client redirect URLs.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.rp_id IS 'Relaying Party Id: Id of the partner id who has created this OIDC client.'; +COMMENT ON COLUMN pms.oidc_client.rp_id IS 'Relaying Party Id: Id of the partner id who has created this OIDC client.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.policy_id IS 'Policy Id: Id of the policy '; +COMMENT ON COLUMN pms.oidc_client.policy_id IS 'Policy Id: Id of the policy '; -- ddl-end -- -COMMENT ON COLUMN oidc_client.status IS 'Client status: Allowed values - ACTIVE / INACTIVE.'; +COMMENT ON COLUMN pms.oidc_client.status IS 'Client status: Allowed values - ACTIVE / INACTIVE.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.public_key IS 'Public key: JWK data.'; +COMMENT ON COLUMN pms.oidc_client.public_key IS 'Public key: JWK data.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.grant_types IS 'Grant Types: Allowed grant types for the client.'; +COMMENT ON COLUMN pms.oidc_client.grant_types IS 'Grant Types: Allowed grant types for the client.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.auth_methods IS 'Client Auth methods: Allowed token endpoint authentication methods.'; +COMMENT ON COLUMN pms.oidc_client.auth_methods IS 'Client Auth methods: Allowed token endpoint authentication methods.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.claims IS 'Requested Claims: claims json as per policy defined for relaying party.'; +COMMENT ON COLUMN pms.oidc_client.claims IS 'Requested Claims: claims json as per policy defined for relaying party.'; -- ddl-end -- -COMMENT ON COLUMN oidc_client.acr_values IS 'Allowed Authentication context References(acr) json'; +COMMENT ON COLUMN pms.oidc_client.acr_values IS 'Allowed Authentication context References(acr) json'; -- ddl-end -- - diff --git a/db_scripts/mosip_pms/deploy.sh b/db_scripts/mosip_pms/deploy.sh index 3660793a443..0d0c3a8097d 100644 --- a/db_scripts/mosip_pms/deploy.sh +++ b/db_scripts/mosip_pms/deploy.sh @@ -1,4 +1,4 @@ -#!/bin/sh + ## Properties file set -e properties_file="$1" @@ -16,32 +16,31 @@ else fi ## Terminate existing connections -echo "Terminating active connections" -CONN=$(PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "SELECT count(pg_terminate_backend(pg_stat_activity.pid)) FROM pg_stat_activity WHERE datname = '$MOSIP_DB_NAME' AND pid <> pg_backend_pid()";exit;) +echo "Terminating active connections" +CONN=$(PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "SELECT count(pg_terminate_backend(pg_stat_activity.pid)) FROM pg_stat_activity WHERE datname = '$MOSIP_DB_NAME' AND pid <> pg_backend_pid()";exit;) echo "Terminated connections" ## Drop db and role echo "Dropping DB" -PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f drop_db.sql +PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f drop_db.sql echo "Dropping user" -PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f drop_role.sql +PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f drop_role.sql ## Create users -echo `date "+%m/%d/%Y %H:%M:%S"` ": Creating database users" -PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f role_dbuser.sql -v dbuserpwd=\'$DBUSER_PWD\' +echo `date "+%m/%d/%Y %H:%M:%S"` ": Creating database users" +PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f role_dbuser.sql -v dbuserpwd=\'$DBUSER_PWD\' ## Create DB echo "Creating DB" -PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f db.sql -PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f ddl.sql +PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f db.sql +PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f ddl.sql ## Grants -PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f grants.sql +PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -f grants.sql ## Populate tables if [ ${DML_FLAG} == 1 ] then - echo `date "+%m/%d/%Y %H:%M:%S"` ": Deploying DML for ${MOSIP_DB_NAME} database" - PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f dml.sql + echo `date "+%m/%d/%Y %H:%M:%S"` ": Deploying DML for ${MOSIP_DB_NAME} database" + PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f dml.sql fi - diff --git a/db_scripts/mosip_pms/dml/pms-auth_policy.csv b/db_scripts/mosip_pms/dml/pms-auth_policy.csv index 030579ca1c0..9779b047616 100644 --- a/db_scripts/mosip_pms/dml/pms-auth_policy.csv +++ b/db_scripts/mosip_pms/dml/pms-auth_policy.csv @@ -1,14 +1,14 @@ id,policy_group_id,name,descr,policy_file_id,policy_type,version,policy_schema,valid_from_date,valid_to_date,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes -mpolicy-default-auth,mpolicygroup-default-auth,mpolicy-default-auth,mpolicy-default-auth,"{""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":true},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":true},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":true},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":true},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":true},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":true},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":true},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":true},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":true},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":true},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":true},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":true},{""attributeName"":""zone"",""source"":[{""attribute"":""zone""}],""encrypted"":true},{""attributeName"":""preferredLang"",""source"":[{""attribute"":""preferredLang""}],""encrypted"":false},{""attributeName"":""individualBiometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics""}],""encrypted"":true,""format"":""extraction""}],""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-abis,mpolicygroup-default-abis,mpolicy-default-abis,mpolicy-default-abis,"{""shareableAttributes"":[{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""registration-client\/NEW\/individualBiometrics"",""filter"":[{""type"":""Iris""}]},{""attribute"":""CNIE\/verification\/biometrics"",""filter"":[{""type"":""Finger""}]},{""attribute"":""CNIE\/verification\/biometrics"",""filter"":[{""type"":""Face""}]}],""encrypted"":true,""format"":""extraction""}],""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""Packet Manager""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-qrcode,mpolicygroup-default-print,mpolicy-default-qrcode,mpolicy-default-qrcode,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-euin,mpolicygroup-default-print,mpolicy-default-euin,mpolicy-default-euin,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-reprint,mpolicygroup-default-print,mpolicy-default-reprint,mpolicy-default-reprint,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-resident,mpolicygroup-default-resident,mpolicy-default-resident,mpolicy-default-resident,"{""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""Print""},""shareableAttributes"":[]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-adjudication,mpolicygroup-default-adjudication,mpolicy-default-adjudication,mpolicy-default-adjudication,"{""shareableAttributes"":[{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""registration-client\/NEW\/individualBiometrics"",""filter"":[{""type"":""Iris""}]},{""attribute"":""CNIE\/verification\/biometrics"",""filter"":[{""type"":""Finger""}]},{""attribute"":""CNIE\/verification\/biometrics"",""filter"":[{""type"":""Face""}]}],""encrypted"":true,""format"":""extraction""},{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":true},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":true},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":true},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":true},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":true},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":true},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":true},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":true},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":true},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":true},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":true},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":true}],""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""100000"",""encryptionType"":""none"",""shareDomain"":""datashare.datashare"",""source"":""Packet Manager""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-cert,mpolicygroup-default-cert,mpolicy-default-cert,mpolicy-default-cert,"{""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":true},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":true},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":true},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":true},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":true},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":true},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":true},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":true},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":true},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":true},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":true},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":true},{""attributeName"":""individualBiometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics""}],""encrypted"":true,""format"":""extraction""}],""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""none"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-eUIN_with_QR,mpolicygroup-default-print,mpolicy-default-eUIN_with_QR,mpolicy-default-eUIN_with_QR,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-eUIN_with_faceQR,mpolicygroup-default-print,mpolicy-default-eUIN_with_faceQR,mpolicy-default-eUIN_with_faceQR,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-PDFCard,mpolicygroup-default-digitalcard,mpolicy-default-PDFCard,mpolicy-default-PDFCard,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""firstName"",""source"":[{""attribute"":""firstName""}],""encrypted"":true},{""attributeName"":""middleName"",""source"":[{""attribute"":""middleName""}],""encrypted"":true},{""attributeName"":""lastName"",""source"":[{""attribute"":""lastName""}],""encrypted"":true},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""PCN"",""source"":[{""attribute"":""VID"",""filter"":[{""type"":""PERPETUAL""}]}],""encrypted"":false,""format"":""RETRIEVE""},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""bestTwoFingers"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Finger""}]}],""encrypted"":false,""format"":""bestTwoFingers""},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":false,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-digitalcard,mpolicygroup-default-digitalcard,mpolicy-default-digitalcard,mpolicy-default-digitalcard,"{""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""250"",""transactionsAllowed"":""10000"",""encryptionType"":""none"",""shareDomain"":""datashare.datashare"",""source"":""Print""},""shareableAttributes"":[]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() -mpolicy-default-mobile,mpolicygroup-default-mobile,mpolicy-default-mobile,mpolicy-default-mobile,"{""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""}]}],""encrypted"":false,""format"":""extraction""}],""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),4/28/2025 9:37,TRUE,admin,now(),admin,now() +mpolicy-default-auth,mpolicygroup-default-auth,mpolicy-default-auth,mpolicy-default-auth,"{""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":true},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":true},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":true},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":true},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":true},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":true},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":true},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":true},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":true},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":true},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":true},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":true},{""attributeName"":""zone"",""source"":[{""attribute"":""zone""}],""encrypted"":true},{""attributeName"":""preferredLang"",""source"":[{""attribute"":""preferredLang""}],""encrypted"":false},{""attributeName"":""individualBiometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics""}],""encrypted"":true,""format"":""extraction""}],""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-abis,mpolicygroup-default-abis,mpolicy-default-abis,mpolicy-default-abis,"{""shareableAttributes"":[{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""registration-client\/NEW\/individualBiometrics"",""filter"":[{""type"":""Iris""}]},{""attribute"":""CNIE\/verification\/biometrics"",""filter"":[{""type"":""Finger""}]},{""attribute"":""CNIE\/verification\/biometrics"",""filter"":[{""type"":""Face""}]}],""encrypted"":true,""format"":""extraction""}],""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""Packet Manager""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-qrcode,mpolicygroup-default-print,mpolicy-default-qrcode,mpolicy-default-qrcode,"{""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-euin,mpolicygroup-default-print,mpolicy-default-euin,mpolicy-default-euin,"{""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-reprint,mpolicygroup-default-print,mpolicy-default-reprint,mpolicy-default-reprint,"{""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-resident,mpolicygroup-default-resident,mpolicy-default-resident,mpolicy-default-resident,"{""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""Print""},""shareableAttributes"":[]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-adjudication,mpolicygroup-default-adjudication,mpolicy-default-adjudication,mpolicy-default-adjudication,"{""shareableAttributes"":[{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""registration-client\/NEW\/individualBiometrics"",""filter"":[{""type"":""Iris""}]},{""attribute"":""CNIE\/verification\/biometrics"",""filter"":[{""type"":""Finger""}]},{""attribute"":""CNIE\/verification\/biometrics"",""filter"":[{""type"":""Face""}]}],""encrypted"":true,""format"":""extraction""},{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":true},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":true},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":true},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":true},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":true},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":true},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":true},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":true},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":true},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":true},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":true},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":true}],""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""100000"",""encryptionType"":""none"",""shareDomain"":""datashare.datashare"",""source"":""Packet Manager""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-cert,mpolicygroup-default-cert,mpolicy-default-cert,mpolicy-default-cert,"{""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":true},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":true},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":true},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":true},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":true},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":true},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":true},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":true},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":true},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":true},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":true},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":true},{""attributeName"":""individualBiometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics""}],""encrypted"":true,""format"":""extraction""}],""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""none"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-eUIN_with_QR,mpolicygroup-default-print,mpolicy-default-eUIN_with_QR,mpolicy-default-eUIN_with_QR,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-eUIN_with_faceQR,mpolicygroup-default-print,mpolicy-default-eUIN_with_faceQR,mpolicy-default-eUIN_with_faceQR,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName"",""filter"":[{""language"":""eng""}]}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":true,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-PDFCard,mpolicygroup-default-digitalcard,mpolicy-default-PDFCard,mpolicy-default-PDFCard,"{""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""},""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":true},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""PCN"",""source"":[{""attribute"":""VID"",""filter"":[{""type"":""PERPETUAL""}]}],""encrypted"":false,""format"":""RETRIEVE""},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""bestTwoFingers"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Finger""}]}],""encrypted"":false,""format"":""bestTwoFingers""},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""},{""type"":""Finger"",""subType"":[""Left Thumb"",""Right Thumb""]}]}],""encrypted"":false,""format"":""extraction""}]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-digitalcard,mpolicygroup-default-digitalcard,mpolicy-default-digitalcard,mpolicy-default-digitalcard,"{""dataSharePolicies"":{""typeOfShare"":""Data Share"",""validForInMinutes"":""250"",""transactionsAllowed"":""10000"",""encryptionType"":""none"",""shareDomain"":""datashare.datashare"",""source"":""Print""},""shareableAttributes"":[]}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() +mpolicy-default-mobile,mpolicygroup-default-mobile,mpolicy-default-mobile,mpolicy-default-mobile,"{""shareableAttributes"":[{""attributeName"":""fullName"",""source"":[{""attribute"":""fullName""}],""encrypted"":false},{""attributeName"":""dateOfBirth"",""source"":[{""attribute"":""dateOfBirth""}],""encrypted"":false,,""format"":""YYYY""},{""attributeName"":""gender"",""source"":[{""attribute"":""gender""}],""encrypted"":false},{""attributeName"":""phone"",""source"":[{""attribute"":""phone""}],""encrypted"":false},{""attributeName"":""email"",""source"":[{""attribute"":""email""}],""encrypted"":false},{""attributeName"":""addressLine1"",""source"":[{""attribute"":""addressLine1""}],""encrypted"":false},{""attributeName"":""addressLine2"",""source"":[{""attribute"":""addressLine2""}],""encrypted"":false},{""attributeName"":""addressLine3"",""source"":[{""attribute"":""addressLine3""}],""encrypted"":false},{""attributeName"":""region"",""source"":[{""attribute"":""region""}],""encrypted"":false},{""attributeName"":""province"",""source"":[{""attribute"":""province""}],""encrypted"":false},{""attributeName"":""city"",""source"":[{""attribute"":""city""}],""encrypted"":false},{""attributeName"":""UIN"",""source"":[{""attribute"":""UIN""}],""encrypted"":false},{""attributeName"":""postalCode"",""source"":[{""attribute"":""postalCode""}],""encrypted"":false},{""attributeName"":""biometrics"",""group"":""CBEFF"",""source"":[{""attribute"":""individualBiometrics"",""filter"":[{""type"":""Face""}]}],""encrypted"":false,""format"":""extraction""}],""dataSharePolicies"":{""typeOfShare"":""direct"",""validForInMinutes"":""30"",""transactionsAllowed"":""2"",""encryptionType"":""Partner Based"",""shareDomain"":""datashare.datashare"",""source"":""ID Repository""}}",DataShare,1,https://schemas.mosip.io/v1/auth-policy,now(),'2028-12-16 12:30:14.183',TRUE,admin,now(),admin,now() diff --git a/db_scripts/mosip_pms/dml/pms-partner_type.csv b/db_scripts/mosip_pms/dml/pms-partner_type.csv index 79f7fb83a11..3809c77f22d 100644 --- a/db_scripts/mosip_pms/dml/pms-partner_type.csv +++ b/db_scripts/mosip_pms/dml/pms-partner_type.csv @@ -11,3 +11,4 @@ MISP_Partner,MISP_Partner,TRUE,superadmin,now(),TRUE Internal_Partner,Used internally to share certs,TRUE,superadmin,now(),TRUE SDK_Partner,SDK Partner,TRUE,superadmin,now(),FALSE Print_Partner,Print Partner,TRUE,superadmin,now(),TRUE +Binding_Partner,Binding Partner,TRUE,superadmin,now(),TRUE diff --git a/partner/partner-management-service/src/main/java/io/mosip/pms/device/util/AuditUtil.java b/partner/partner-management-service/src/main/java/io/mosip/pms/device/util/AuditUtil.java index e77fe5c5356..6fee1c51f95 100644 --- a/partner/partner-management-service/src/main/java/io/mosip/pms/device/util/AuditUtil.java +++ b/partner/partner-management-service/src/main/java/io/mosip/pms/device/util/AuditUtil.java @@ -35,11 +35,11 @@ import io.mosip.kernel.core.exception.ExceptionUtils; import io.mosip.kernel.core.exception.ServiceError; import io.mosip.kernel.core.util.DateUtils; +import io.mosip.pms.common.constant.AuditErrorCode; import io.mosip.pms.common.exception.ValidationException; import io.mosip.pms.common.request.dto.RequestWrapper; import io.mosip.pms.common.response.dto.ResponseWrapper; import io.mosip.pms.common.util.RestUtil; -import io.mosip.pms.device.constant.AuditErrorCode; import io.mosip.pms.device.exception.DeviceServiceException; import io.mosip.pms.device.util.dto.AuditRequestDto; import io.mosip.pms.device.util.dto.AuditResponseDto; diff --git a/partner/partner-management-service/src/main/java/io/mosip/pms/oidc/client/service/impl/ClientManagementServiceImpl.java b/partner/partner-management-service/src/main/java/io/mosip/pms/oidc/client/service/impl/ClientManagementServiceImpl.java index 3c7fb560bdc..eccf2449d3f 100644 --- a/partner/partner-management-service/src/main/java/io/mosip/pms/oidc/client/service/impl/ClientManagementServiceImpl.java +++ b/partner/partner-management-service/src/main/java/io/mosip/pms/oidc/client/service/impl/ClientManagementServiceImpl.java @@ -79,6 +79,7 @@ public class ClientManagementServiceImpl implements ClientManagementService { private static final String AUTH_POLICY_TYPE = "Auth"; private static final String AUTH_PARTNER_TYPE = "Auth_Partner"; private static final String ERROR_MESSAGE = "errorMessage"; + public static final String ACTIVE = "ACTIVE"; @Autowired ObjectMapper objectMapper; @@ -203,7 +204,7 @@ public ClientDetailResponse createOIDCClient(ClientDetailCreateRequest createReq ErrorCode.PARTNER_HAVING_NO_ACRVALUES.getErrorMessage()); } clientDetail.setAcrValues( String.join(",",acrValues)); - clientDetail.setStatus("ACTIVE"); + clientDetail.setStatus(ACTIVE); clientDetail.setGrantTypes(String.join(",", createRequest.getGrantTypes())); clientDetail.setClientAuthMethods(String.join(",", createRequest.getClientAuthMethods())); clientDetail.setCreatedDateTime(LocalDateTime.now(ZoneId.of("UTC"))); @@ -400,7 +401,7 @@ public ClientDetailResponse updateOIDCClient(String clientId, ClientDetailUpdate clientDetail.setRedirectUris(String.join(",", updateRequest.getRedirectUris())); clientDetail.setGrantTypes(String.join(",", updateRequest.getGrantTypes())); clientDetail.setClientAuthMethods(String.join(",", updateRequest.getClientAuthMethods())); - clientDetail.setStatus(updateRequest.getStatus()); + clientDetail.setStatus(updateRequest.getStatus().toUpperCase()); clientDetail.setUpdatedDateTime(LocalDateTime.now(ZoneId.of("UTC"))); clientDetail.setUpdatedBy(getLoggedInUserId()); makeUpdateIDPServiceCall(clientDetail, environment.getProperty("mosip.pms.esignet.oidc-client-update-url")); @@ -532,4 +533,4 @@ private List convertStringToList(String commaSeparatedString){ private String getLoggedInUserId() { return UserDetailUtil.getLoggedInUserId(); } -} \ No newline at end of file +} diff --git a/partner/partner-management-service/src/main/java/io/mosip/pms/partner/manager/service/impl/PartnerManagementServiceImpl.java b/partner/partner-management-service/src/main/java/io/mosip/pms/partner/manager/service/impl/PartnerManagementServiceImpl.java index 67c3f9ad9b9..2bcb22b33da 100644 --- a/partner/partner-management-service/src/main/java/io/mosip/pms/partner/manager/service/impl/PartnerManagementServiceImpl.java +++ b/partner/partner-management-service/src/main/java/io/mosip/pms/partner/manager/service/impl/PartnerManagementServiceImpl.java @@ -583,7 +583,18 @@ public APIKeyGenerateResponseDto generateAPIKey(String partnerId, APIKeyGenerate throw new PartnerManagerServiceException(ErrorCode.LOGGEDIN_USER_NOT_AUTHORIZED.getErrorCode(), ErrorCode.LOGGEDIN_USER_NOT_AUTHORIZED.getErrorMessage()); } - AuthPolicy validPolicy = authPolicyRepository.findByPolicyName(requestDto.getPolicyName()); + Optional partnerFromDb = partnerRepository.findById(partnerId); + if (partnerFromDb.isEmpty()) { + auditUtil.setAuditRequestDto(PartnerManageEnum.GENERATE_API_KEY_FAILURE, partnerId, "partnerId"); + throw new PartnerManagerServiceException(ErrorCode.PARTNER_ID_DOES_NOT_EXIST_EXCEPTION.getErrorCode(), + ErrorCode.PARTNER_ID_DOES_NOT_EXIST_EXCEPTION.getErrorMessage()); + } + if (!partnerFromDb.get().getIsActive()) { + auditUtil.setAuditRequestDto(PartnerManageEnum.GENERATE_API_KEY_FAILURE, partnerId, "partnerId"); + throw new PartnerManagerServiceException(ErrorCode.PARTNER_NOT_ACTIVE_EXCEPTION.getErrorCode(), + ErrorCode.PARTNER_NOT_ACTIVE_EXCEPTION.getErrorMessage()); + } + AuthPolicy validPolicy = authPolicyRepository.findByPolicyGroupIdAndName(partnerFromDb.get().getPolicyGroupId(),requestDto.getPolicyName()); if(validPolicy == null) { auditUtil.setAuditRequestDto(PartnerManageEnum.GENERATE_API_KEY_FAILURE, partnerId, "partnerId"); throw new PartnerManagerServiceException(ErrorCode.POLICY_NOT_EXIST_EXCEPTION.getErrorCode(), @@ -597,17 +608,6 @@ public APIKeyGenerateResponseDto generateAPIKey(String partnerId, APIKeyGenerate throw new PartnerManagerServiceException(ErrorCode.PARTNER_POLICY_MAPPING_NOT_EXISTS.getErrorCode(), ErrorCode.PARTNER_POLICY_MAPPING_NOT_EXISTS.getErrorMessage()); } - Optional partnerFromDb = partnerRepository.findById(partnerId); - if (partnerFromDb.isEmpty()) { - auditUtil.setAuditRequestDto(PartnerManageEnum.GENERATE_API_KEY_FAILURE, partnerId, "partnerId"); - throw new PartnerManagerServiceException(ErrorCode.PARTNER_ID_DOES_NOT_EXIST_EXCEPTION.getErrorCode(), - ErrorCode.PARTNER_ID_DOES_NOT_EXIST_EXCEPTION.getErrorMessage()); - } - if (!partnerFromDb.get().getIsActive()) { - auditUtil.setAuditRequestDto(PartnerManageEnum.GENERATE_API_KEY_FAILURE, partnerId, "partnerId"); - throw new PartnerManagerServiceException(ErrorCode.PARTNER_NOT_ACTIVE_EXCEPTION.getErrorCode(), - ErrorCode.PARTNER_NOT_ACTIVE_EXCEPTION.getErrorMessage()); - } PartnerPolicy policyByLabel = partnerPolicyRepository.findByPartnerIdPolicyIdAndLabel( partnerFromDb.get().getId(), validPolicy.getId(), requestDto.getLabel()); if(policyByLabel != null) { diff --git a/partner/partner-management-service/src/main/java/io/mosip/pms/partner/service/impl/PartnerServiceImpl.java b/partner/partner-management-service/src/main/java/io/mosip/pms/partner/service/impl/PartnerServiceImpl.java index 78feaf5f24f..562583d6e94 100644 --- a/partner/partner-management-service/src/main/java/io/mosip/pms/partner/service/impl/PartnerServiceImpl.java +++ b/partner/partner-management-service/src/main/java/io/mosip/pms/partner/service/impl/PartnerServiceImpl.java @@ -518,7 +518,7 @@ public PartnerResponse updatePartnerDetails(PartnerUpdateDto partnerUpdateReques } private AuthPolicy validatePolicyGroupAndPolicy(String policyGroupId, String policyName) { - AuthPolicy authPolicyFromDb = authPolicyRepository.findByPolicyGroupAndName(policyGroupId, policyName); + AuthPolicy authPolicyFromDb = authPolicyRepository.findByPolicyGroupIdAndName(policyGroupId, policyName); if (authPolicyFromDb == null) { auditUtil.setAuditRequestDto(PartnerServiceAuditEnum.SUBMIT_API_REQUEST_FAILURE, policyName, "policyName"); throw new PartnerServiceException(ErrorCode.POLICY_GROUP_POLICY_NOT_EXISTS.getErrorCode(), diff --git a/partner/partner-management-service/src/test/java/io/mosip/pms/test/partner/service/impl/PartnerManagementServiceImplTest.java b/partner/partner-management-service/src/test/java/io/mosip/pms/test/partner/service/impl/PartnerManagementServiceImplTest.java index 40b26308dce..671e76e2441 100644 --- a/partner/partner-management-service/src/test/java/io/mosip/pms/test/partner/service/impl/PartnerManagementServiceImplTest.java +++ b/partner/partner-management-service/src/test/java/io/mosip/pms/test/partner/service/impl/PartnerManagementServiceImplTest.java @@ -948,10 +948,11 @@ public void approveRejectPartnerPolicyMappingTest05() { public void generateAPIKeyTest() { APIKeyGenerateRequestDto request = new APIKeyGenerateRequestDto(); request.setLabel("unique"); - request.setPolicyName("policyName"); - Mockito.when(authPolicyRepository.findByPolicyName(request.getPolicyName())).thenReturn(getAuthPolicies().get(0)); + request.setPolicyName("policyName"); + Optional newPartner = Optional.of(getPartner()); + Mockito.when(partnerRepository.findById("partner")).thenReturn(newPartner); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName(newPartner.get().getPolicyGroupId(),request.getPolicyName())).thenReturn(getAuthPolicies().get(0)); Mockito.when((partnerPolicyRequestRepository.findByPartnerIdAndPolicyIdAndStatusCode(Mockito.any(),Mockito.any(),Mockito.any()))).thenReturn(List.of(getPartnerPolicyRequestData())); - Mockito.when(partnerRepository.findById("partner")).thenReturn(Optional.of(getPartner())); Mockito.when(partnerPolicyRepository.findByPartnerIdPolicyIdAndLabel("partner","234","unique")).thenReturn(getPartnerPolicy()); Map response = new HashMap<>(); response.put("response", getCertResponse()); @@ -964,39 +965,36 @@ public void generateAPIKeyTest() { }catch (PartnerManagerServiceException e) { assertTrue(e.getErrorCode().equals(ErrorCode.LOGGEDIN_USER_NOT_AUTHORIZED.getErrorCode())); } - - Mockito.when(authPolicyRepository.findByPolicyName(request.getPolicyName())).thenReturn(null); + Mockito.when(partnerRepository.findById("partner")).thenReturn(Optional.empty()); try { partnerManagementImpl.generateAPIKey("partner", request); }catch (PartnerManagerServiceException e) { - assertTrue(e.getErrorCode().equals(ErrorCode.POLICY_NOT_EXIST_EXCEPTION.getErrorCode())); + assertTrue(e.getErrorCode().equals(ErrorCode.PARTNER_ID_DOES_NOT_EXIST_EXCEPTION.getErrorCode())); } - Mockito.when(authPolicyRepository.findByPolicyName(request.getPolicyName())).thenReturn(getAuthPolicies().get(0)); - Mockito.when((partnerPolicyRequestRepository.findByPartnerIdAndPolicyIdAndStatusCode(Mockito.any(),Mockito.any(),Mockito.any()))).thenReturn(Collections.emptyList()); + Optional partner = Optional.of(getPartner()); + partner.get().setIsActive(false); + Mockito.when(partnerRepository.findById("partner")).thenReturn(partner); try { partnerManagementImpl.generateAPIKey("partner", request); }catch (PartnerManagerServiceException e) { - assertTrue(e.getErrorCode().equals(ErrorCode.PARTNER_POLICY_MAPPING_NOT_EXISTS.getErrorCode())); + assertTrue(e.getErrorCode().equals(ErrorCode.PARTNER_NOT_ACTIVE_EXCEPTION.getErrorCode())); } - Mockito.when(authPolicyRepository.findByPolicyName(request.getPolicyName())).thenReturn(getAuthPolicies().get(0)); - Mockito.when((partnerPolicyRequestRepository.findByPartnerIdAndPolicyIdAndStatusCode(Mockito.any(),Mockito.any(),Mockito.any()))).thenReturn(List.of(getPartnerPolicyRequestData())); - Mockito.when(partnerRepository.findById("partner")).thenReturn(Optional.empty()); + Mockito.when(partnerRepository.findById("partner")).thenReturn(newPartner); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName(request.getPolicyName(),newPartner.get().getPolicyGroupId())).thenReturn(null); try { partnerManagementImpl.generateAPIKey("partner", request); }catch (PartnerManagerServiceException e) { - assertTrue(e.getErrorCode().equals(ErrorCode.PARTNER_ID_DOES_NOT_EXIST_EXCEPTION.getErrorCode())); - } - Mockito.when(authPolicyRepository.findByPolicyName(request.getPolicyName())).thenReturn(getAuthPolicies().get(0)); - Mockito.when((partnerPolicyRequestRepository.findByPartnerIdAndPolicyIdAndStatusCode(Mockito.any(),Mockito.any(),Mockito.any()))).thenReturn(List.of(getPartnerPolicyRequestData())); - Optional partner = Optional.of(getPartner()); - partner.get().setIsActive(false); - Mockito.when(partnerRepository.findById("partner")).thenReturn(partner); + assertTrue(e.getErrorCode().equals(ErrorCode.POLICY_NOT_EXIST_EXCEPTION.getErrorCode())); + } + Mockito.when(partnerRepository.findById("partner")).thenReturn(newPartner); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName(newPartner.get().getPolicyGroupId(),request.getPolicyName())).thenReturn(getAuthPolicies().get(0)); + Mockito.when((partnerPolicyRequestRepository.findByPartnerIdAndPolicyIdAndStatusCode(Mockito.any(),Mockito.any(),Mockito.any()))).thenReturn(Collections.emptyList()); try { partnerManagementImpl.generateAPIKey("partner", request); }catch (PartnerManagerServiceException e) { - assertTrue(e.getErrorCode().equals(ErrorCode.PARTNER_NOT_ACTIVE_EXCEPTION.getErrorCode())); + assertTrue(e.getErrorCode().equals(ErrorCode.PARTNER_POLICY_MAPPING_NOT_EXISTS.getErrorCode())); } - Mockito.when(authPolicyRepository.findByPolicyName(request.getPolicyName())).thenReturn(getAuthPolicies().get(0)); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName(request.getPolicyName(),newPartner.get().getPolicyGroupId())).thenReturn(getAuthPolicies().get(0)); Mockito.when((partnerPolicyRequestRepository.findByPartnerIdAndPolicyIdAndStatusCode(Mockito.any(),Mockito.any(),Mockito.any()))).thenReturn(List.of(getPartnerPolicyRequestData())); Mockito.when(partnerRepository.findById("partner")).thenReturn(Optional.of(getPartner())); Mockito.when(partnerPolicyRepository.findByPartnerIdPolicyIdAndLabel("123456","234","unique")).thenReturn(getPartnerPolicy()); diff --git a/partner/partner-management-service/src/test/java/io/mosip/pms/test/partner/service/impl/PartnerServiceImplTest.java b/partner/partner-management-service/src/test/java/io/mosip/pms/test/partner/service/impl/PartnerServiceImplTest.java index e67bbb27d58..65f8edc990c 100644 --- a/partner/partner-management-service/src/test/java/io/mosip/pms/test/partner/service/impl/PartnerServiceImplTest.java +++ b/partner/partner-management-service/src/test/java/io/mosip/pms/test/partner/service/impl/PartnerServiceImplTest.java @@ -789,7 +789,7 @@ public void mapPartnerPolicyCredentialType_001() { Mockito.when(partnerRepository.findById("12345")).thenReturn(partner); Mockito.when(authPolicyRepository.findById("12345")).thenReturn(Optional.of(createAuthPolicy())); Mockito.when(authPolicyRepository - .findByPolicyGroupAndName(Mockito.anyString(), Mockito.anyString())).thenReturn(createAuthPolicy()); + .findByPolicyGroupIdAndName(Mockito.anyString(), Mockito.anyString())).thenReturn(createAuthPolicy()); pserviceImpl.mapPartnerPolicyCredentialType("euin", "12345", "12345"); } @@ -879,7 +879,7 @@ public void requestForPolicyMappingTest() { Optional partner = Optional.of(createPartner(true)); partner.get().setPartnerTypeCode("Auth_Partner"); Mockito.when(partnerRepository.findById("12345")).thenReturn(partner); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345","policyName")).thenReturn(createAuthPolicy()); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345","policyName")).thenReturn(createAuthPolicy()); Mockito.when(partnerPolicyRequestRepository.findByPartnerIdAndPolicyId("12345","123")).thenReturn(List.of(createPartnerPolicyRequest("approved"))); pserviceImpl.requestForPolicyMapping(request, "12345"); partner.get().setPolicyGroupId(null); @@ -921,7 +921,7 @@ public void requestForPolicyMappingTest() { } partner.get().setIsActive(true); Mockito.when(partnerRepository.findById("12345")).thenReturn(partner); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345","policyName")).thenReturn(null); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345","policyName")).thenReturn(null); try { pserviceImpl.requestForPolicyMapping(request, "12345"); }catch (PartnerServiceException e) { @@ -929,7 +929,7 @@ public void requestForPolicyMappingTest() { } AuthPolicy authPolicy = createAuthPolicy(); authPolicy.setIsActive(false); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345","policyName")).thenReturn(authPolicy); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345","policyName")).thenReturn(authPolicy); try { pserviceImpl.requestForPolicyMapping(request, "12345"); }catch (PartnerServiceException e) { @@ -938,7 +938,7 @@ public void requestForPolicyMappingTest() { authPolicy = createAuthPolicy(); authPolicy.setIsActive(true); authPolicy.setValidToDate(LocalDateTime.now().minusMonths(3)); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345","policyName")).thenReturn(authPolicy); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345","policyName")).thenReturn(authPolicy); try { pserviceImpl.requestForPolicyMapping(request, "12345"); }catch (PartnerServiceException e) { @@ -947,7 +947,7 @@ public void requestForPolicyMappingTest() { authPolicy = createAuthPolicy(); authPolicy.setIsActive(true); authPolicy.getPolicyGroup().setIsActive(false); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345","policyName")).thenReturn(authPolicy); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345","policyName")).thenReturn(authPolicy); try { pserviceImpl.requestForPolicyMapping(request, "12345"); }catch (PartnerServiceException e) { @@ -1264,4 +1264,4 @@ private String caCertResponse() { } -} \ No newline at end of file +} diff --git a/partner/partner-management-service/src/main/java/io/mosip/pms/device/constant/AuditErrorCode.java b/partner/pms-common/src/main/java/io/mosip/pms/common/constant/AuditErrorCode.java similarity index 92% rename from partner/partner-management-service/src/main/java/io/mosip/pms/device/constant/AuditErrorCode.java rename to partner/pms-common/src/main/java/io/mosip/pms/common/constant/AuditErrorCode.java index da40be95118..01946e66e2a 100644 --- a/partner/partner-management-service/src/main/java/io/mosip/pms/device/constant/AuditErrorCode.java +++ b/partner/pms-common/src/main/java/io/mosip/pms/common/constant/AuditErrorCode.java @@ -1,4 +1,4 @@ -package io.mosip.pms.device.constant; +package io.mosip.pms.common.constant; public enum AuditErrorCode { diff --git a/partner/pms-common/src/main/java/io/mosip/pms/common/repository/AuthPolicyRepository.java b/partner/pms-common/src/main/java/io/mosip/pms/common/repository/AuthPolicyRepository.java index 65344ae87b9..14471392017 100644 --- a/partner/pms-common/src/main/java/io/mosip/pms/common/repository/AuthPolicyRepository.java +++ b/partner/pms-common/src/main/java/io/mosip/pms/common/repository/AuthPolicyRepository.java @@ -13,7 +13,7 @@ public interface AuthPolicyRepository extends JpaRepository{ @Query(value = "select * from auth_policy ap where ap.policy_group_id=?1 and ap.name = ?2",nativeQuery = true) - AuthPolicy findByPolicyGroupAndName(String policyGroupId, String name); + AuthPolicy findByPolicyGroupIdAndName(String policyGroupId, String name); @Query(value = "select * from auth_policy ap where ap.policy_group_id=?1 and ap.id = ?2",nativeQuery = true) AuthPolicy findByPolicyGroupAndId(String policyGroupId, String policyId); diff --git a/partner/pms-common/src/main/java/io/mosip/pms/common/util/AuthenticationContextRefUtil.java b/partner/pms-common/src/main/java/io/mosip/pms/common/util/AuthenticationContextRefUtil.java index 7b7ffadef91..7dd73b38070 100644 --- a/partner/pms-common/src/main/java/io/mosip/pms/common/util/AuthenticationContextRefUtil.java +++ b/partner/pms-common/src/main/java/io/mosip/pms/common/util/AuthenticationContextRefUtil.java @@ -101,7 +101,7 @@ private Map, String> getAllClaims() { Map, String> claimsMap = new HashMap<>(); List allowedClaims = getSupportedClaims(); for(String claim:allowedClaims) { - if(map.get(claim).getValue()!=null) { + if(map.containsKey(claim)) { claimsMap.put(convertStringToList(map.get(claim).getValue()),claim); } } @@ -166,4 +166,4 @@ public Set getPolicySupportedClaims(Set claimsFromPolicy) { private List convertStringToList(String commaSeparatedString){ return Arrays.asList(commaSeparatedString.split(",")); } -} \ No newline at end of file +} diff --git a/partner/policy-management-service/src/main/java/io/mosip/pms/policy/service/PolicyManagementService.java b/partner/policy-management-service/src/main/java/io/mosip/pms/policy/service/PolicyManagementService.java index a1e237d6463..95ab0c591cb 100644 --- a/partner/policy-management-service/src/main/java/io/mosip/pms/policy/service/PolicyManagementService.java +++ b/partner/policy-management-service/src/main/java/io/mosip/pms/policy/service/PolicyManagementService.java @@ -294,7 +294,7 @@ public PolicyCreateResponseDto updatePolicies(PolicyUpdateRequestDto requestDto, throw new PolicyManagementServiceException(ErrorMessages.PUBLISHED_POLICY_NOT_UPDATED.getErrorCode(), ErrorMessages.PUBLISHED_POLICY_NOT_UPDATED.getErrorMessage()); } - AuthPolicy mappedPolicy = authPolicyRepository.findByPolicyGroupAndName(policyGroup.getId(), + AuthPolicy mappedPolicy = authPolicyRepository.findByPolicyGroupIdAndName(policyGroup.getId(), requestDto.getName()); if (mappedPolicy != null && !mappedPolicy.getName().equals(authPolicy.getName())) { auditUtil.setAuditRequestDto(PolicyManageEnum.UPDATE_POLICY_FAILURE, requestDto.getName(), "policyName"); @@ -354,7 +354,7 @@ private PolicyGroupCreateResponseDto savePolicyGroup(PolicyGroup policyGroup) { * @return */ private void validateAuthPolicyName(String policyGroupId, String auth_policy_name) { - AuthPolicy auth_policy_by_name = authPolicyRepository.findByPolicyGroupAndName(policyGroupId, auth_policy_name); + AuthPolicy auth_policy_by_name = authPolicyRepository.findByPolicyGroupIdAndName(policyGroupId, auth_policy_name); if (auth_policy_by_name != null) { auditUtil.setAuditRequestDto(PolicyManageEnum.CREATE_POLICY_FAILURE, auth_policy_name, "policyName"); throw new PolicyManagementServiceException( @@ -445,7 +445,7 @@ private PolicyResponseDto mapPolicyAndPolicyGroup(AuthPolicy authPolicy) private PolicyCreateResponseDto savePolicy(JSONObject policyJson, String oldPolicyName, String newPolicyName, String policyDesc, String policyGroupId, String policyType, String policyGroupName, String version, String authPolicyId) throws PolicyManagementServiceException, Exception { - AuthPolicy authPolicy = authPolicyRepository.findByPolicyGroupAndName(policyGroupId, oldPolicyName); + AuthPolicy authPolicy = authPolicyRepository.findByPolicyGroupIdAndName(policyGroupId, oldPolicyName); if (authPolicy != null) { authPolicy.setId(authPolicy.getId()); authPolicy.setDescr(policyDesc); @@ -1049,4 +1049,4 @@ public List getActivePolicyDetailsByGroupName(String policyGro return policiesByGroupName; } -} \ No newline at end of file +} diff --git a/partner/policy-management-service/src/main/java/io/mosip/pms/policy/util/AuditUtil.java b/partner/policy-management-service/src/main/java/io/mosip/pms/policy/util/AuditUtil.java index 3869a8a8bea..496bb38e249 100644 --- a/partner/policy-management-service/src/main/java/io/mosip/pms/policy/util/AuditUtil.java +++ b/partner/policy-management-service/src/main/java/io/mosip/pms/policy/util/AuditUtil.java @@ -11,27 +11,37 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; -import org.springframework.http.MediaType; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.HttpServerErrorException; +import org.springframework.web.client.HttpStatusCodeException; import org.springframework.web.client.RestTemplate; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import io.mosip.kernel.core.authmanager.authadapter.model.AuthUserDetails; +import io.mosip.kernel.core.authmanager.exception.AuthNException; +import io.mosip.kernel.core.authmanager.exception.AuthZException; import io.mosip.kernel.core.exception.ExceptionUtils; import io.mosip.kernel.core.exception.ServiceError; import io.mosip.kernel.core.http.RequestWrapper; import io.mosip.kernel.core.http.ResponseWrapper; import io.mosip.kernel.core.logger.spi.Logger; import io.mosip.kernel.core.util.DateUtils; +import io.mosip.pms.common.constant.AuditErrorCode; import io.mosip.pms.common.exception.ValidationException; import io.mosip.pms.common.util.PMSLogger; import io.mosip.pms.common.util.RestUtil; import io.mosip.pms.policy.dto.AuditRequestDto; import io.mosip.pms.policy.dto.AuditResponseDto; import io.mosip.pms.policy.dto.PolicyManageEnum; +import io.mosip.pms.policy.errorMessages.PolicyManagementServiceException; @Component @@ -122,16 +132,18 @@ public void setAuditRequestDto(PolicyManageEnum PartnerManageEnum, String refId callAuditManager(auditRequestDto); } - private void callAuditManager(AuditRequestDto auditRequestDto) { + private void callAuditManager(AuditRequestDto auditRequestDto) { RequestWrapper auditReuestWrapper = new RequestWrapper<>(); auditReuestWrapper.setRequest(auditRequestDto); HttpEntity> httpEntity = new HttpEntity<>(auditReuestWrapper); - String response =null; + ResponseEntity response =null; try { - response = restUtil.postApi(auditUrl, null, "", "", MediaType.APPLICATION_JSON, httpEntity, String.class); - getAuditDetailsFromResponse(response); - } catch (Exception ex) { - log.error("Error occured while calling audit service", ex); + response = restTemplate.exchange(auditUrl, HttpMethod.POST, httpEntity, String.class); + getAuditDetailsFromResponse(response.getBody()); + } catch (HttpClientErrorException | HttpServerErrorException ex) { + handlException( ex); + } catch (Exception e) { + log.error("Failed to get response from audit manager", e); } } @@ -150,7 +162,8 @@ private AuditResponseDto getAuditDetailsFromResponse(String responseBody) throws }); auditResponseDto = responseObject.getResponse(); } catch (IOException | NullPointerException exception) { - throw exception; + throw new PolicyManagementServiceException(AuditErrorCode.AUDIT_PARSE_EXCEPTION.getErrorCode(), + AuditErrorCode.AUDIT_PARSE_EXCEPTION.getErrorMessage()); } return auditResponseDto; @@ -167,4 +180,27 @@ private String getUserId() { return SecurityContextHolder.getContext().getAuthentication().getName(); } } -} \ No newline at end of file + + private void handlException(HttpStatusCodeException ex) { + List validationErrorsList = ExceptionUtils.getServiceErrorList(ex.getResponseBodyAsString()); + + if (ex.getRawStatusCode() == 401) { + if (!validationErrorsList.isEmpty()) { + throw new AuthNException(validationErrorsList); + } else { + throw new BadCredentialsException("Authentication failed from AuthManager"); + } + } + if (ex.getRawStatusCode() == 403) { + if (!validationErrorsList.isEmpty()) { + throw new AuthZException(validationErrorsList); + } else { + throw new AccessDeniedException("Access denied from AuthManager"); + } + } + throw new PolicyManagementServiceException(AuditErrorCode.AUDIT_EXCEPTION.getErrorCode(), + AuditErrorCode.AUDIT_EXCEPTION.getErrorMessage() + ex); + + } + +} diff --git a/partner/policy-management-service/src/test/java/io/mosip/pms/policy/test/service/PolicyServiceTest.java b/partner/policy-management-service/src/test/java/io/mosip/pms/policy/test/service/PolicyServiceTest.java index 30155ea3c9e..a2456cec2ae 100644 --- a/partner/policy-management-service/src/test/java/io/mosip/pms/policy/test/service/PolicyServiceTest.java +++ b/partner/policy-management-service/src/test/java/io/mosip/pms/policy/test/service/PolicyServiceTest.java @@ -338,7 +338,7 @@ public void createPoliciesTest_S004() throws PolicyManagementServiceException, E PolicyCreateRequestDto request = createPoliciesRequest(); request.setPolicyType("Data_Share"); Mockito.when(policyGroupRepository.findByName("Test_Policy_Group_001")).thenReturn(policyGroupData()); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345","Test_001")).thenReturn(getAuthPolicy()); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345","Test_001")).thenReturn(getAuthPolicy()); service.createPolicies(request); } @@ -376,7 +376,7 @@ public void createPoliciesTest_S007() throws PolicyManagementServiceException, E Mockito.when(mapper.readValue(new URL("http://localhost:8999/schema"), JsonNode.class)).thenReturn(actualObj); Mockito.when(policyGroupRepository.findByName("Test_Policy_Group_001")).thenReturn(policyGroupData()); Mockito.when(authPolicyRepository.findByName("Test")).thenReturn(getAuthPolicy()); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345","Test")).thenReturn(getAuthPolicy()); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345","Test")).thenReturn(getAuthPolicy()); try { service.createPolicies(request); }catch (PolicyManagementServiceException e) { @@ -571,7 +571,7 @@ public void updatePolicies_PolicyNameDuplicateTest() throws PolicyManagementServ AuthPolicy authPolicyName = getAuthPolicy(); authPolicyName.getPolicyGroup().setId("12345"); authPolicyName.setName("Test_01"); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test")).thenReturn(authPolicyName); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test")).thenReturn(authPolicyName); service.updatePolicies(request, "12345"); } @@ -597,7 +597,7 @@ public void updatePolicies_Test_01() throws PolicyManagementServiceException, Ex AuthPolicy authPolicyName = getAuthPolicy(); authPolicyName.getPolicyGroup().setId("12345"); authPolicyName.setName("Test_01"); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test")).thenReturn(authPolicyName); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test")).thenReturn(authPolicyName); service.updatePolicies(request, "12345"); } @@ -625,7 +625,7 @@ public void updatePolicies_Test_02() throws PolicyManagementServiceException, Ex authPolicyName.setPolicySchema("localhost"); authPolicyName.getPolicyGroup().setId("12345"); authPolicyName.setName("Test_01"); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test")).thenReturn(authPolicyName); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test")).thenReturn(authPolicyName); service.updatePolicies(request, "12345"); } @@ -654,7 +654,7 @@ public void updatePolicies_Test_03() throws PolicyManagementServiceException, Ex authPolicyName.getPolicyGroup().setId("12345"); authPolicyName.setName("Test_01"); authPolicyName.setPolicy_type("Auth"); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test")).thenReturn(authPolicyName); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test")).thenReturn(authPolicyName); ObjectMapper objectMapper = new ObjectMapper(); JsonNode actualObj = objectMapper.readTree(authPolicySchema); Mockito.when(mapper.readValue(new URL("http://localhost:8999/schema"), JsonNode.class)).thenReturn(actualObj); @@ -686,7 +686,7 @@ public void updatePolicies_Test_04() throws PolicyManagementServiceException, Ex authPolicyName.getPolicyGroup().setId("12345"); authPolicyName.setName("Test_01"); authPolicyName.setPolicy_type("Auth"); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test_01")).thenReturn(authPolicyName); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test_01")).thenReturn(authPolicyName); ObjectMapper objectMapper = new ObjectMapper(); JsonNode actualObj = objectMapper.readTree(authPolicySchema); Mockito.when(mapper.readValue(new URL("http://localhost:8999/schema"), JsonNode.class)).thenReturn(actualObj); @@ -738,7 +738,7 @@ public void publishPolicy_PolicyPublishedTest() throws JsonParseException, JsonM Mockito.when(authPolicyRepository.findByName("Test")).thenReturn(authPolicy); Optional policy = Optional.of(policyGroup); Mockito.when(policyGroupRepository.findByName("Test")).thenReturn(policy.get()); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test")).thenReturn(getAuthPolicy()); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test")).thenReturn(getAuthPolicy()); service.publishPolicy("Test", "Test"); } @@ -762,7 +762,7 @@ public void publishPolicyTest() throws JsonParseException, JsonMappingException, Mockito.when(authPolicyRepository.findById("Test")).thenReturn(Optional.of(authPolicy)); Optional policy = Optional.of(policyGroup); Mockito.when(policyGroupRepository.findById("Test")).thenReturn(policy); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test")).thenReturn(getAuthPolicy()); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test")).thenReturn(getAuthPolicy()); Mockito.when(policyGroupRepository.findById("12345")).thenReturn(policy); service.publishPolicy("Test", "Test"); } @@ -788,7 +788,7 @@ public void publishPolicyTest_02() throws JsonParseException, JsonMappingExcepti Mockito.when(authPolicyRepository.findById("Test")).thenReturn(Optional.of(authPolicy)); Optional policy = Optional.of(policyGroup); Mockito.when(policyGroupRepository.findById("Test")).thenReturn(policy); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test")).thenReturn(getAuthPolicy()); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test")).thenReturn(getAuthPolicy()); Mockito.when(policyGroupRepository.findById("12345")).thenReturn(policy); try { service.publishPolicy("Test", "Test"); @@ -821,7 +821,7 @@ public void publishPolicyTest_01() throws JsonParseException, JsonMappingExcepti AuthPolicy authPolicy01 = getAuthPolicy(); authPolicy01.setIsActive(false); authPolicy01.setPolicySchema("localhost"); - Mockito.when(authPolicyRepository.findByPolicyGroupAndName("12345", "Test")).thenReturn(authPolicy01); + Mockito.when(authPolicyRepository.findByPolicyGroupIdAndName("12345", "Test")).thenReturn(authPolicy01); Mockito.when(policyGroupRepository.findById("12345")).thenReturn(policy); service.publishPolicy("Test", "Test"); } diff --git a/partner/policy-validator/src/main/java/io/mosip/pms/policy/validator/constants/PolicyValidatorErrorConstant.java b/partner/policy-validator/src/main/java/io/mosip/pms/policy/validator/constants/PolicyValidatorErrorConstant.java index ea8db37face..1811515f6ad 100644 --- a/partner/policy-validator/src/main/java/io/mosip/pms/policy/validator/constants/PolicyValidatorErrorConstant.java +++ b/partner/policy-validator/src/main/java/io/mosip/pms/policy/validator/constants/PolicyValidatorErrorConstant.java @@ -9,9 +9,9 @@ public enum PolicyValidatorErrorConstant { INVALID_POLICY_SCHEMA("PMS_PV_004", "Invalid policy schema"), - INVALID_INPUT_PARAMETER("PMS_PV_005", "Invalid input parameter - %s"), + INVALID_INPUT_PARAMETER("PMS_PV_005", "Invalid input parameter - %s in policy data"), - MISSING_INPUT_PARAMETER("PMS_PV_006", "Missing input parameter - %s"); + MISSING_INPUT_PARAMETER("PMS_PV_006", "Missing input parameter - %s in policy data"); private final String errorCode;