diff --git a/.github/workflows/push_trigger.yml b/.github/workflows/push_trigger.yml index f92362392a0..6c51d3ae12a 100644 --- a/.github/workflows/push_trigger.yml +++ b/.github/workflows/push_trigger.yml @@ -119,7 +119,7 @@ jobs: - name: Publish the maven package run: | - mvn -B deploy -DaltDeploymentRepository=ossrh::default::${{ secrets.OSSRH_SNAPSHOT_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml + mvn -B deploy -DaltDeploymentRepository=ossrh::default::${{ secrets.RELEASE_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml env: GITHUB_TOKEN: ${{secrets.RELEASE_TOKEN}} GPG_TTY: $(tty) diff --git a/.github/workflows/release_changes.yml b/.github/workflows/release_changes.yml index 0b5e369eb71..ae56c63a9a5 100644 --- a/.github/workflows/release_changes.yml +++ b/.github/workflows/release_changes.yml @@ -43,13 +43,19 @@ jobs: # - name: removing --Dgpg.skip # run: find . -type f -name "*push_trigger.yml" -print0 | xargs -0 sed -i "s/"-Dgpg.skip"//g" - + + - name: update Branch name in badges + run: | + sed -i 's/branch=.*)]/branch=${{ env.BRANCH_NAME }}\)]/g' README.md + sed -i 's/branch=.*\&/branch=${{ env.BRANCH_NAME }}\&/g' README.md + - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: - commit-message: Updated Pom versions for release changes + commit-message: Release Bot Pre-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 }} + token: ${{ secrets.ACTION_PAT }} diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml new file mode 100644 index 00000000000..e9bba0e65a0 --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,43 @@ +name: Tagging of repos + +env: + tag: v1.2.3 + +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag to be published' + required: true + default: 'v1.2.3' + 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 + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.event.inputs.tag }} + release_name: ${{ github.event.inputs.tag }} + body: | + ${{ github.event.inputs.body }} + draft: false + prerelease: ${{fromJSON(github.event.inputs.pre-release)}} diff --git a/README.md b/README.md index 9877305393d..fbbdcdf0e4e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Maven Package upon a push](https://github.com/mosip/commons/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0)](https://github.com/mosip/commons/actions/workflows/push_trigger.yml) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_commons&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.2.0&id=mosip_commons) +[![Maven Package upon a push](https://github.com/mosip/commons/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/commons/actions/workflows/push_trigger.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_commons&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.2.0.1&id=mosip_commons) # Commons diff --git a/db_release_scripts/mosip_iam/iam_release_db_deploy.sh b/db_release_scripts/mosip_iam/iam_release_db_deploy.sh deleted file mode 100644 index 0becfeeb8ab..00000000000 --- a/db_release_scripts/mosip_iam/iam_release_db_deploy.sh +++ /dev/null @@ -1,92 +0,0 @@ -### -- --------------------------------------------------------------------------------------------------------- -### -- Script Name : Iam Release DB deploy -### -- Deploy Module : MOSIP Iam -### -- Purpose : To deploy Iam Database alter scripts for the release. -### -- Created By : Ram Bhatt -### -- Created Date : Jan-2021 -### -- -### -- Modified Date Modified By Comments / Remarks -### -- ----------------------------------------------------------------------------------------------------------- - -### -- ----------------------------------------------------------------------------------------------------------- - -#########Properties file ############# -set -e -properties_file="$1" -release_version="$2" - echo `date "+%m/%d/%Y %H:%M:%S"` ": Properties File Name - $properties_file" - echo `date "+%m/%d/%Y %H:%M:%S"` ": DB Deploymnet Version - $release_version" -#properties_file="./app.properties" -if [ -f "$properties_file" ] -then - echo `date "+%m/%d/%Y %H:%M:%S"` ": Property file \"$properties_file\" found." - while IFS='=' read -r key value - do - key=$(echo $key | tr '.' '_') - eval ${key}=\${value} - done < "$properties_file" -else - echo `date "+%m/%d/%Y %H:%M:%S"` ": Property file not found, Pass property file name as argument." -fi -echo `date "+%m/%d/%Y %H:%M:%S"` ": ------------------ Database server and service status check for ${MOSIP_DB_NAME}------------------------" - -today=`date '+%d%m%Y_%H%M%S'`; -LOG="${LOG_PATH}${MOSIP_DB_NAME}-release-${release_version}-${today}.log" -touch $LOG - -SERVICE=$(PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "select count(1) from pg_roles where rolname IN('sysadmin')";exit; > /dev/null) - -if [ "$SERVICE" -eq 0 ] || [ "$SERVICE" -eq 1 ] -then -echo `date "+%m/%d/%Y %H:%M:%S"` ": Postgres database server and service is up and running" | tee -a $LOG 2>&1 -else -echo `date "+%m/%d/%Y %H:%M:%S"` ": Postgres database server or service is not running" | tee -a $LOG 2>&1 -fi - -echo `date "+%m/%d/%Y %H:%M:%S"` ": ----------------------------------------------------------------------------------------" - -echo `date "+%m/%d/%Y %H:%M:%S"` ": Started sourcing the $MOSIP_DB_NAME Database Alter scripts" | tee -a $LOG 2>&1 - -echo `date "+%m/%d/%Y %H:%M:%S"` ": Database Alter scripts are sourcing from :$BASEPATH/$MOSIP_DB_NAME/" | tee -a $LOG 2>&1 - -#========================================DB Alter Scripts deployment process begins on IDMAP DB SERVER================================== - -echo `date "+%m/%d/%Y %H:%M:%S"` ": Alter scripts deployment on $MOSIP_DB_NAME database is started....Deployment Version...$release_version" | tee -a $LOG 2>&1 - -ALTER_SCRIPT_FILENAME_VERSION="sql/${release_version}_${ALTER_SCRIPT_FILENAME}" - -echo `date "+%m/%d/%Y %H:%M:%S"` ": Alter scripts file which is considered for release deployment - $ALTER_SCRIPT_FILENAME_VERSION" | tee -a $LOG 2>&1 - -cd /$BASEPATH/$MOSIP_DB_NAME/ - -pwd | tee -a $LOG 2>&1 - -CONN=$(PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_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; >> $LOG 2>&1) - -if [ ${CONN} == 0 ] -then - echo `date "+%m/%d/%Y %H:%M:%S"` ": No active database connections exist on ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1 -else - echo `date "+%m/%d/%Y %H:%M:%S"` ": Active connections exist on the database server and active connection will be terminated for DB deployment." | tee -a $LOG 2>&1 -fi - -if [ ${ALTER_SCRIPT_FLAG} == 1 ] -then - echo `date "+%m/%d/%Y %H:%M:%S"` ": Deploying Alter scripts for ${MOSIP_DB_NAME} database" | tee -a $LOG 2>&1 - PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $ALTER_SCRIPT_FILENAME_VERSION >> $LOG 2>&1 -else - echo `date "+%m/%d/%Y %H:%M:%S"` ": There are no alter scripts available for this deployment at ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1 -fi - -if [ $(grep -c ERROR $LOG) -ne 0 ] -then - echo `date "+%m/%d/%Y %H:%M:%S"` ": Database Alter scripts deployment version $release_version is completed with ERRORS, Please check the logs for more information" | tee -a $LOG 2>&1 - echo `date "+%m/%d/%Y %H:%M:%S"` ": END of Alter scripts MOSIP database deployment" | tee -a $LOG 2>&1 -else - echo `date "+%m/%d/%Y %H:%M:%S"` ": Database Alter scripts deployment version $release_version completed successfully, Please check the logs for more information" | tee -a $LOG 2>&1 - echo `date "+%m/%d/%Y %H:%M:%S"` ": END of MOSIP \"${MOSIP_DB_NAME}\" database alter scripts deployment" | tee -a $LOG 2>&1 -fi - -echo "******************************************"`date "+%m/%d/%Y %H:%M:%S"` "*****************************************************" >> $LOG 2>&1 - - diff --git a/db_release_scripts/mosip_iam/iam_release_deploy.properties b/db_release_scripts/mosip_iam/iam_release_deploy.properties deleted file mode 100644 index 53859114efd..00000000000 --- a/db_release_scripts/mosip_iam/iam_release_deploy.properties +++ /dev/null @@ -1,12 +0,0 @@ -DB_SERVERIP= -DB_PORT=30090 -SU_USER=postgres -DEFAULT_DB_NAME=postgres -MOSIP_DB_NAME=mosip_iam -SYSADMIN_USER=sysadmin -BASEPATH=/home/madmin/database_release -LOG_PATH=/home/madmin/logs/ -ALTER_SCRIPT_FLAG=1 -ALTER_SCRIPT_FILENAME=iam-scripts_release.sql -REVOKE_SCRIPT_FLAG=1 -REVOKE_SCRIPT_FILENAME=iam-scripts_revoke.sql diff --git a/db_release_scripts/mosip_iam/iam_revoke_db_deploy.sh b/db_release_scripts/mosip_iam/iam_revoke_db_deploy.sh deleted file mode 100644 index f6d9bbdc97a..00000000000 --- a/db_release_scripts/mosip_iam/iam_revoke_db_deploy.sh +++ /dev/null @@ -1,92 +0,0 @@ -### -- --------------------------------------------------------------------------------------------------------- -### -- Script Name : IAM Revoke DB deploy -### -- Deploy Module : MOSIP Iam -### -- Purpose : To revoke Iam Database alter scripts for the release. -### -- Create By : Ram Bhatt -### -- Created Date : Jan-2021 -### -- -### -- Modified Date Modified By Comments / Remarks -### -- ----------------------------------------------------------------------------------------------------------- - -### -- ----------------------------------------------------------------------------------------------------------- - -#########Properties file ############# -set -e -properties_file="$1" -revoke_version="$2" - echo `date "+%m/%d/%Y %H:%M:%S"` ": $properties_file" - echo `date "+%m/%d/%Y %H:%M:%S"` ": DB Revoke Version - $revoke_version" -#properties_file="./app.properties" -if [ -f "$properties_file" ] -then - echo `date "+%m/%d/%Y %H:%M:%S"` ": Property file \"$properties_file\" found." - while IFS='=' read -r key value - do - key=$(echo $key | tr '.' '_') - eval ${key}=\${value} - done < "$properties_file" -else - echo `date "+%m/%d/%Y %H:%M:%S"` ": Property file not found, Pass property file name as argument." -fi -echo `date "+%m/%d/%Y %H:%M:%S"` ": ------------------ Database server and service status check for ${MOSIP_DB_NAME}------------------------" - -today=`date '+%d%m%Y_%H%M%S'`; -LOG="${LOG_PATH}${MOSIP_DB_NAME}-revoke-${today}.log" -touch $LOG - -SERVICE=$(PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "select count(1) from pg_roles where rolname IN('sysadmin')";exit; > /dev/null) - -if [ "$SERVICE" -eq 0 ] || [ "$SERVICE" -eq 1 ] -then -echo `date "+%m/%d/%Y %H:%M:%S"` ": Postgres database server and service is up and running" | tee -a $LOG 2>&1 -else -echo `date "+%m/%d/%Y %H:%M:%S"` ": Postgres database server or service is not running" | tee -a $LOG 2>&1 -fi - -echo `date "+%m/%d/%Y %H:%M:%S"` ": ----------------------------------------------------------------------------------------" - -echo `date "+%m/%d/%Y %H:%M:%S"` ": Started sourcing the $MOSIP_DB_NAME Database Deployment Revoke scripts" | tee -a $LOG 2>&1 - -echo `date "+%m/%d/%Y %H:%M:%S"` ": Database revoke scripts are sourcing from :$BASEPATH/$MOSIP_DB_NAME/alter-scripts" | tee -a $LOG 2>&1 - -#========================================DB Alter Scripts deployment process begins on IDMAP DB SERVER================================== - -echo `date "+%m/%d/%Y %H:%M:%S"` ": Revoke scripts for DB deployment on $MOSIP_DB_NAME database is started....Revoke Version...$revoke_version" | tee -a $LOG 2>&1 - -REVOKE_SCRIPT_FILENAME_VERSION="sql/${revoke_version}_${REVOKE_SCRIPT_FILENAME}" - -echo `date "+%m/%d/%Y %H:%M:%S"` ": Alter scripts file which is considered for deployment revoke - $REVOKE_SCRIPT_FILENAME_VERSION" | tee -a $LOG 2>&1 - -cd /$BASEPATH/$MOSIP_DB_NAME/ - -pwd | tee -a $LOG 2>&1 - -CONN=$(PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_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; >> $LOG 2>&1) - -if [ ${CONN} == 0 ] -then - echo `date "+%m/%d/%Y %H:%M:%S"` ": No active database connections exist on ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1 -else - echo `date "+%m/%d/%Y %H:%M:%S"` ": Active connections exist on the database server and active connection will be terminated for DB deployment." | tee -a $LOG 2>&1 -fi - -if [ ${REVOKE_SCRIPT_FLAG} == 1 ] -then - echo `date "+%m/%d/%Y %H:%M:%S"` ": Executing revoke scripts for ${MOSIP_DB_NAME} database" | tee -a $LOG 2>&1 - PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $REVOKE_SCRIPT_FILENAME_VERSION >> $LOG 2>&1 -else - echo `date "+%m/%d/%Y %H:%M:%S"` ": There are no revoke scripts available for this deployment at ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1 -fi - -if [ $(grep -c ERROR $LOG) -ne 0 ] -then - echo `date "+%m/%d/%Y %H:%M:%S"` ": Database deployment revoke version $revoke_version is completed with ERRORS, Please check the logs for more information" | tee -a $LOG 2>&1 - echo `date "+%m/%d/%Y %H:%M:%S"` ": END of Alter scripts MOSIP database deployment" | tee -a $LOG 2>&1 -else - echo `date "+%m/%d/%Y %H:%M:%S"` ": Database deployment revoke version $revoke_version completed successfully, Please check the logs for more information" | tee -a $LOG 2>&1 - echo `date "+%m/%d/%Y %H:%M:%S"` ": END of MOSIP \"${MOSIP_DB_NAME}\" database deployment revoke" | tee -a $LOG 2>&1 -fi - -echo "******************************************"`date "+%m/%d/%Y %H:%M:%S"` "*****************************************************" >> $LOG 2>&1 - - diff --git a/db_release_scripts/mosip_iam/sql/1.1.5_iam-scripts_release.sql b/db_release_scripts/mosip_iam/sql/1.1.5_iam-scripts_release.sql deleted file mode 100644 index 4dafde1c8b0..00000000000 --- a/db_release_scripts/mosip_iam/sql/1.1.5_iam-scripts_release.sql +++ /dev/null @@ -1,18 +0,0 @@ --- ------------------------------------------------------------------------------------------------- --- Database Name : mosip_iam --- Release Version : 1.2.0-SNAPSHOT --- Purpose : Database Alter scripts for the release for IAM DB. --- Create By : Ram Bhatt --- Created Date : Jan-2021 --- --- Modified Date Modified By Comments / Remarks --- --- ------------------------------------------------------------------------------------------------- - -\c mosip_iam sysadmin - --- ------------------------------------------------------------------------------------------------- - - - ----------------------------------------------------------------------------------------------------- diff --git a/db_release_scripts/mosip_iam/sql/1.1.5_iam-scripts_revoke.sql b/db_release_scripts/mosip_iam/sql/1.1.5_iam-scripts_revoke.sql deleted file mode 100644 index 56c56a43749..00000000000 --- a/db_release_scripts/mosip_iam/sql/1.1.5_iam-scripts_revoke.sql +++ /dev/null @@ -1,13 +0,0 @@ --- ------------------------------------------------------------------------------------------------- --- Database Name : mosip_iam --- Release Version : 1.2.0-SNAPSHOT --- Purpose : Revoking Database Alter deployement done for release in Iam DB. --- Create By : Ram Bhatt --- Created Date : Jan-2021 --- --- Modified Date Modified By Comments / Remarks --- ------------------------------------------------------------------------------------------------- - -\c mosip_iam sysadmin - ------------------------------------------------------------------------------------------------------ diff --git a/db_release_scripts/mosip_kernel/kernel_release_deploy.properties b/db_release_scripts/mosip_kernel/deploy.properties similarity index 100% rename from db_release_scripts/mosip_kernel/kernel_release_deploy.properties rename to db_release_scripts/mosip_kernel/deploy.properties diff --git a/db_release_scripts/mosip_kernel/kernel_release_db_deploy.sh b/db_release_scripts/mosip_kernel/deploy.sh similarity index 100% rename from db_release_scripts/mosip_kernel/kernel_release_db_deploy.sh rename to db_release_scripts/mosip_kernel/deploy.sh diff --git a/db_release_scripts/mosip_kernel/kernel_revoke_db_deploy.sh b/db_release_scripts/mosip_kernel/revoke.sh similarity index 100% rename from db_release_scripts/mosip_kernel/kernel_revoke_db_deploy.sh rename to db_release_scripts/mosip_kernel/revoke.sh diff --git a/db_release_scripts/mosip_kernel/sql/1.1.0_kernel-scripts_release.sql b/db_release_scripts/mosip_kernel/sql/1.1.0-release.sql similarity index 100% rename from db_release_scripts/mosip_kernel/sql/1.1.0_kernel-scripts_release.sql rename to db_release_scripts/mosip_kernel/sql/1.1.0-release.sql diff --git a/db_release_scripts/mosip_kernel/sql/1.1.0_kernel-scripts_revoke.sql b/db_release_scripts/mosip_kernel/sql/1.1.0-revoke.sql similarity index 100% rename from db_release_scripts/mosip_kernel/sql/1.1.0_kernel-scripts_revoke.sql rename to db_release_scripts/mosip_kernel/sql/1.1.0-revoke.sql diff --git a/db_release_scripts/mosip_kernel/sql/1.1.4_kernel-scripts_release.sql b/db_release_scripts/mosip_kernel/sql/1.1.4-release.sql similarity index 100% rename from db_release_scripts/mosip_kernel/sql/1.1.4_kernel-scripts_release.sql rename to db_release_scripts/mosip_kernel/sql/1.1.4-release.sql diff --git a/db_release_scripts/mosip_kernel/sql/1.1.4_kernel-scripts_revoke.sql b/db_release_scripts/mosip_kernel/sql/1.1.4-revoke.sql similarity index 100% rename from db_release_scripts/mosip_kernel/sql/1.1.4_kernel-scripts_revoke.sql rename to db_release_scripts/mosip_kernel/sql/1.1.4-revoke.sql diff --git a/db_release_scripts/mosip_kernel/sql/1.1.5_kernel-scripts_release.sql b/db_release_scripts/mosip_kernel/sql/1.1.5_kernel-scripts_release.sql deleted file mode 100644 index 42c77e63a9d..00000000000 --- a/db_release_scripts/mosip_kernel/sql/1.1.5_kernel-scripts_release.sql +++ /dev/null @@ -1,20 +0,0 @@ --- ------------------------------------------------------------------------------------------------- --- Database Name : mosip_kernel --- Release Version : 1.2.0-SNAPSHOT --- Purpose : Database Alter scripts for the release for Kernel DB. --- Create By : Ram Bhatt --- Created Date : Jan-2021 --- --- Modified Date Modified By Comments / Remarks --- ------------------------------------------------------------------------------------------------- - -\c mosip_kernel sysadmin - - - - - - - - ----------------------------------------------------------------------------------------------------- diff --git a/db_release_scripts/mosip_kernel/sql/1.1.5_kernel-scripts_revoke.sql b/db_release_scripts/mosip_kernel/sql/1.1.5_kernel-scripts_revoke.sql deleted file mode 100644 index 7852097cf20..00000000000 --- a/db_release_scripts/mosip_kernel/sql/1.1.5_kernel-scripts_revoke.sql +++ /dev/null @@ -1,13 +0,0 @@ --- ------------------------------------------------------------------------------------------------- --- Database Name : mosip_kernel --- Release Version : 1.2.0-SNAPSHOT --- Purpose : Revoking Database Alter deployement done for release in Kernel DB. --- Create By : Ram Bhatt --- Created Date : Jan-2021 --- --- Modified Date Modified By Comments / Remarks --- ------------------------------------------------------------------------------------------------- - -\c mosip_kernel sysadmin - ------------------------------------------------------------------------------------------------------ diff --git a/db_release_scripts/mosip_kernel/sql/1.1.2_kernel-scripts_release.sql b/db_release_scripts/mosip_kernel/sql/1.2.0-release.sql similarity index 100% rename from db_release_scripts/mosip_kernel/sql/1.1.2_kernel-scripts_release.sql rename to db_release_scripts/mosip_kernel/sql/1.2.0-release.sql diff --git a/db_release_scripts/mosip_kernel/sql/1.1.2_kernel-scripts_revoke.sql b/db_release_scripts/mosip_kernel/sql/1.2.0-revoke.sql similarity index 100% rename from db_release_scripts/mosip_kernel/sql/1.1.2_kernel-scripts_revoke.sql rename to db_release_scripts/mosip_kernel/sql/1.2.0-revoke.sql diff --git a/kernel/kernel-applicanttype-api/pom.xml b/kernel/kernel-applicanttype-api/pom.xml index 1ff28afa36b..ec2fa195a5c 100644 --- a/kernel/kernel-applicanttype-api/pom.xml +++ b/kernel/kernel-applicanttype-api/pom.xml @@ -5,7 +5,7 @@ io.mosip.kernel kernel-applicanttype-api Mosip Applicant type API - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 11 11 @@ -17,7 +17,7 @@ io.mosip.kernel kernel-core - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 org.mvel diff --git a/kernel/kernel-authcodeflowproxy-api/pom.xml b/kernel/kernel-authcodeflowproxy-api/pom.xml index d56d08bf2dd..fbea8ddfb7d 100644 --- a/kernel/kernel-authcodeflowproxy-api/pom.xml +++ b/kernel/kernel-authcodeflowproxy-api/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-authcodeflowproxy-api - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 jar kernel-authcodeflowproxy-api Mosip commons project @@ -220,7 +220,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/constants/Errors.java b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/constants/Errors.java index be58c0378b2..3486aba46a1 100644 --- a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/constants/Errors.java +++ b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/constants/Errors.java @@ -35,7 +35,8 @@ public enum Errors { EXCEPTION("KER-ACP-500", "Exception occured "), ALLOWED_URL_EXCEPTION("KER-ACP-009", "url not found in allowed url's"), STATE_NULL_EXCEPTION("KER-ACP-010", "state is null or empty"), - STATE_NOT_UUID_EXCEPTION("KER-ACP-011", "state is not uuid"); + STATE_NOT_UUID_EXCEPTION("KER-ACP-011", "state is not uuid"), + UNSUPPORTED_ENCODING_EXCEPTION("KER-ACP-012", "unsupported encoding exception :"); /** * The error code diff --git a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/controller/LoginController.java b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/controller/LoginController.java index 6dfbb974cd1..972009b65bf 100644 --- a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/controller/LoginController.java +++ b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/controller/LoginController.java @@ -1,6 +1,8 @@ package io.mosip.kernel.authcodeflowproxy.api.controller; import java.io.IOException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.UUID; @@ -19,6 +21,10 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.util.UriComponentsBuilder; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.interfaces.DecodedJWT; import io.mosip.kernel.authcodeflowproxy.api.constants.Errors; import io.mosip.kernel.authcodeflowproxy.api.dto.AccessTokenResponseDTO; @@ -29,6 +35,7 @@ import io.mosip.kernel.core.authmanager.model.AuthResponseDto; import io.mosip.kernel.core.http.ResponseFilter; import io.mosip.kernel.core.http.ResponseWrapper; +import io.mosip.kernel.core.util.CryptoUtil; import io.mosip.kernel.core.util.EmptyCheckUtils; @RestController @@ -127,14 +134,22 @@ public ResponseWrapper validateAdminToken(HttpServletRequest reque responseWrapper.setResponse(mosipUserDto); return responseWrapper; } - + @ResponseFilter - @DeleteMapping(value = "/logout/user") - public ResponseWrapper logoutUser( - @CookieValue(value = "Authorization", required = false) String token, HttpServletResponse res) { - AuthResponseDto authResponseDto = loginService.logoutUser(token); - ResponseWrapper responseWrapper = new ResponseWrapper<>(); - responseWrapper.setResponse(authResponseDto); - return responseWrapper; + @GetMapping(value = "/logout/user") + public void logoutUser( + @CookieValue(value = "Authorization", required = false) String token,@RequestParam(name = "redirecturi", required = true) String redirectURI, HttpServletResponse res) throws IOException { + redirectURI = new String(Base64.decodeBase64(redirectURI)); + if(redirectURI.contains("#")) { + redirectURI= redirectURI.split("#")[0]; + } + if(!allowedUrls.contains(redirectURI)) { + LOGGER.error("Url {} was not part of allowed url's",redirectURI); + throw new ServiceException(Errors.ALLOWED_URL_EXCEPTION.getErrorCode(), Errors.ALLOWED_URL_EXCEPTION.getErrorMessage()); + } + String uri = loginService.logoutUser(token,redirectURI); + res.setStatus(302); + res.sendRedirect(uri); } + } \ No newline at end of file diff --git a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/exception/AuthCodeProxyExceptionHandler.java b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/exception/AuthCodeProxyExceptionHandler.java index b6777ce6978..97a5b85209b 100644 --- a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/exception/AuthCodeProxyExceptionHandler.java +++ b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/exception/AuthCodeProxyExceptionHandler.java @@ -11,6 +11,7 @@ import org.springframework.core.annotation.Order; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.util.ContentCachingRequestWrapper; @@ -48,6 +49,14 @@ public ResponseEntity> servieException( return new ResponseEntity<>( getErrorResponse(httpServletRequest, e.getErrorCode(), e.getErrorText()), HttpStatus.OK); } + + @ExceptionHandler(AuthenticationServiceException.class) + public ResponseEntity> servieException( + HttpServletRequest httpServletRequest, final AuthenticationServiceException e) throws IOException { + ExceptionUtils.logRootCause(e); + return new ResponseEntity<>( + getErrorResponse(httpServletRequest,Errors.INVALID_TOKEN.getErrorCode(), e.getMessage()), HttpStatus.OK); + } @ExceptionHandler(AuthRestException.class) public ResponseEntity> authRestException( diff --git a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/service/LoginService.java b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/service/LoginService.java index 021ac39575c..1d739234238 100644 --- a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/service/LoginService.java +++ b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/service/LoginService.java @@ -6,7 +6,6 @@ import io.mosip.kernel.authcodeflowproxy.api.dto.AccessTokenResponseDTO; import io.mosip.kernel.authcodeflowproxy.api.dto.MosipUserDto; -import io.mosip.kernel.core.authmanager.model.AuthResponseDto; public interface LoginService { @@ -20,7 +19,7 @@ public interface LoginService { AccessTokenResponseDTO loginRedirect(String state, String sessionState, String code, String stateCookie, String redirectURI); - AuthResponseDto logoutUser(String token); + String logoutUser(String token, String redirectURI); } diff --git a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/service/impl/LoginServiceImpl.java b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/service/impl/LoginServiceImpl.java index 9120d2a9d10..2db2f7ad1ac 100644 --- a/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/service/impl/LoginServiceImpl.java +++ b/kernel/kernel-authcodeflowproxy-api/src/main/java/io/mosip/kernel/authcodeflowproxy/api/service/impl/LoginServiceImpl.java @@ -1,6 +1,9 @@ package io.mosip.kernel.authcodeflowproxy.api.service.impl; import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -30,7 +33,6 @@ import io.mosip.kernel.authcodeflowproxy.api.constants.Constants; import io.mosip.kernel.authcodeflowproxy.api.constants.Errors; -import io.mosip.kernel.authcodeflowproxy.api.constants.IAMConstants; import io.mosip.kernel.authcodeflowproxy.api.dto.AccessTokenResponse; import io.mosip.kernel.authcodeflowproxy.api.dto.AccessTokenResponseDTO; import io.mosip.kernel.authcodeflowproxy.api.dto.IAMErrorResponseDto; @@ -39,7 +41,6 @@ import io.mosip.kernel.authcodeflowproxy.api.exception.ClientException; import io.mosip.kernel.authcodeflowproxy.api.exception.ServiceException; import io.mosip.kernel.authcodeflowproxy.api.service.LoginService; -import io.mosip.kernel.core.authmanager.model.AuthResponseDto; import io.mosip.kernel.core.exception.ExceptionUtils; import io.mosip.kernel.core.exception.ServiceError; import io.mosip.kernel.core.http.ResponseWrapper; @@ -89,6 +90,14 @@ public class LoginServiceImpl implements LoginService { @Value("${auth.server.admin.validate.url}") private String validateUrl; + + + @Value("${mosip.iam.post-logout-uri-param-key:post_logout_redirect_uri}") + private String postLogoutRedirectURIParamKey; + + @Value("${mosip.iam.end-session-endpoint-path:/protocol/openid-connect/logout}") + private String endSessionEndpointPath; + @Autowired private RestTemplate restTemplate; @@ -96,14 +105,6 @@ public class LoginServiceImpl implements LoginService { @Autowired private ObjectMapper objectMapper; - private static final String LOG_OUT_FAILED = "log out failed"; - - private static final String FAILED = "Failed"; - - private static final String SUCCESS = "Success"; - - private static final String SUCCESSFULLY_LOGGED_OUT = "successfully loggedout"; - @Override public String login(String redirectURI, String state) { Map pathParam = new HashMap<>(); @@ -225,35 +226,21 @@ private IAMErrorResponseDto parseKeyClockErrorResponse(HttpStatusCodeException e } @Override - public AuthResponseDto logoutUser(String token) { + public String logoutUser(String token,String redirectURI) { if (EmptyCheckUtils.isNullEmpty(token)) { throw new AuthenticationServiceException(Errors.INVALID_TOKEN.getErrorMessage()); } - Map pathparams = new HashMap<>(); String issuer = getissuer(token); - ResponseEntity response = null; - AuthResponseDto authResponseDto = new AuthResponseDto(); - StringBuilder urlBuilder = new StringBuilder().append(issuer).append("/protocol/openid-connect/logout"); - UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(urlBuilder.toString()) - .queryParam(IAMConstants.ID_TOKEN_HINT, token); - + StringBuilder urlBuilder = new StringBuilder().append(issuer).append(endSessionEndpointPath); + UriComponentsBuilder uriComponentsBuilder; try { - response = restTemplate.getForEntity(uriComponentsBuilder.buildAndExpand(pathparams).toUriString(), - String.class); - - } catch (HttpClientErrorException | HttpServerErrorException e) { - throw new ServiceException(Errors.REST_EXCEPTION.getErrorCode(), - Errors.REST_EXCEPTION.getErrorMessage() + e.getResponseBodyAsString()); - } - - if (response.getStatusCode().is2xxSuccessful()) { - authResponseDto.setMessage(SUCCESSFULLY_LOGGED_OUT); - authResponseDto.setStatus(SUCCESS); - } else { - authResponseDto.setMessage(LOG_OUT_FAILED); - authResponseDto.setStatus(FAILED); + uriComponentsBuilder = UriComponentsBuilder.fromUriString(urlBuilder.toString()) + .queryParam(postLogoutRedirectURIParamKey, URLEncoder.encode(redirectURI, StandardCharsets.UTF_8.toString())); + } catch (UnsupportedEncodingException e) { + throw new ServiceException(Errors.UNSUPPORTED_ENCODING_EXCEPTION.getErrorCode(), + Errors.UNSUPPORTED_ENCODING_EXCEPTION.getErrorMessage() + Constants.WHITESPACE + e.getMessage()); } - return authResponseDto; + return uriComponentsBuilder.build().toString(); } public String getissuer(String token) { diff --git a/kernel/kernel-authcodeflowproxy-api/src/test/java/io/mosip/kernel/authcodeflowproxy/api/test/controller/AuthProxyControllerTests.java b/kernel/kernel-authcodeflowproxy-api/src/test/java/io/mosip/kernel/authcodeflowproxy/api/test/controller/AuthProxyControllerTests.java index 979cec2a27d..c5df1d8cb12 100644 --- a/kernel/kernel-authcodeflowproxy-api/src/test/java/io/mosip/kernel/authcodeflowproxy/api/test/controller/AuthProxyControllerTests.java +++ b/kernel/kernel-authcodeflowproxy-api/src/test/java/io/mosip/kernel/authcodeflowproxy/api/test/controller/AuthProxyControllerTests.java @@ -42,16 +42,19 @@ import io.mosip.kernel.authcodeflowproxy.api.test.AuthProxyFlowTestBootApplication; import io.mosip.kernel.core.exception.ServiceError; import io.mosip.kernel.core.http.ResponseWrapper; +import io.mosip.kernel.core.util.CryptoUtil; @SpringBootTest(classes = { AuthProxyFlowTestBootApplication.class }) @RunWith(SpringRunner.class) @AutoConfigureMockMvc public class AuthProxyControllerTests { - @Value("${auth.server.admin.validate.url}") private String validateUrl; - + + @Value("${mosip.iam.post-logout-uri-param-key}") + private String postLogoutRedirectURIParamKey; + @Autowired private RestTemplate restTemplate; @@ -60,7 +63,7 @@ public class AuthProxyControllerTests { @Before public void init() { mockServer = MockRestServiceServer.createServer(restTemplate); - + } @Autowired @@ -69,7 +72,6 @@ public void init() { @Autowired private ObjectMapper objectMapper; - @Test public void validateTokenTest() throws Exception { ResponseWrapper responseWrapper = new ResponseWrapper(); @@ -79,132 +81,89 @@ public void validateTokenTest() throws Exception { mosipUserDto.setMobile("9999999999"); mosipUserDto.setRole("MOCK-ROLE"); responseWrapper.setResponse(mosipUserDto); - - - mockServer.expect(ExpectedCount.once(), - requestTo(new URI(validateUrl))) - .andExpect(method(HttpMethod.GET)) - .andRespond(withStatus(HttpStatus.OK) - .contentType(MediaType.APPLICATION_JSON) - .body(objectMapper.writeValueAsString(responseWrapper))); + + mockServer.expect(ExpectedCount.once(), requestTo(new URI(validateUrl))).andExpect(method(HttpMethod.GET)) + .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON) + .body(objectMapper.writeValueAsString(responseWrapper))); Cookie cookie = new Cookie("Authorization", "mock_access_token"); - mockMvc.perform(get("/authorize/admin/validateToken").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isOk()) - .andExpect(jsonPath("$.response.userId", is("mock-user"))); + mockMvc.perform(get("/authorize/admin/validateToken").contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().isOk()).andExpect(jsonPath("$.response.userId", is("mock-user"))); } - + @Test public void validateTokenHttpClientExceptionTest() throws Exception { ResponseWrapper responseWrapper = new ResponseWrapper(); - ServiceError serviceError = new ServiceError("KER-ATH-401", "un auth"); + ServiceError serviceError = new ServiceError("KER-ATH-401", "un auth"); List serviceErrors = new ArrayList<>(); serviceErrors.add(serviceError); responseWrapper.setErrors(serviceErrors); - mockServer.expect(ExpectedCount.once(), - requestTo(new URI(validateUrl))) - .andExpect(method(HttpMethod.GET)) - .andRespond(withStatus(HttpStatus.UNAUTHORIZED) - .contentType(MediaType.APPLICATION_JSON) - .body(objectMapper.writeValueAsString(responseWrapper))); + mockServer.expect(ExpectedCount.once(), requestTo(new URI(validateUrl))).andExpect(method(HttpMethod.GET)) + .andRespond(withStatus(HttpStatus.UNAUTHORIZED).contentType(MediaType.APPLICATION_JSON) + .body(objectMapper.writeValueAsString(responseWrapper))); Cookie cookie = new Cookie("Authorization", "mock_access_token"); - mockMvc.perform(get("/authorize/admin/validateToken").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isUnauthorized()) - .andExpect(jsonPath("$.errors[0].errorCode", is("KER-ATH-401"))); + mockMvc.perform(get("/authorize/admin/validateToken").contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().isUnauthorized()).andExpect(jsonPath("$.errors[0].errorCode", is("KER-ATH-401"))); } - + @Test public void validateTokenInternalServerTest() throws Exception { ResponseWrapper responseWrapper = new ResponseWrapper(); - ServiceError serviceError = new ServiceError("KER-ATH-401", "un auth"); + ServiceError serviceError = new ServiceError("KER-ATH-401", "un auth"); List serviceErrors = new ArrayList<>(); serviceErrors.add(serviceError); responseWrapper.setErrors(serviceErrors); - mockServer.expect(ExpectedCount.once(), - requestTo(new URI(validateUrl))) - .andExpect(method(HttpMethod.GET)) - .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.APPLICATION_JSON) - .body(objectMapper.writeValueAsString("internal server error"))); + mockServer.expect(ExpectedCount.once(), requestTo(new URI(validateUrl))).andExpect(method(HttpMethod.GET)) + .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR).contentType(MediaType.APPLICATION_JSON) + .body(objectMapper.writeValueAsString("internal server error"))); Cookie cookie = new Cookie("Authorization", "mock_access_token"); - mockMvc.perform(get("/authorize/admin/validateToken").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isOk()) + mockMvc.perform(get("/authorize/admin/validateToken").contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().isOk()) .andExpect(jsonPath("$.errors[0].errorCode", is(Errors.REST_EXCEPTION.getErrorCode()))); } - + @Test public void validateTokenErrorResponseTest() throws Exception { ResponseWrapper responseWrapper = new ResponseWrapper(); - List errors =new ArrayList<>(); - ServiceError error= new ServiceError("MOCKERRORCODE", "MOCKERROR"); - errors.add(error); + List errors = new ArrayList<>(); + ServiceError error = new ServiceError("MOCKERRORCODE", "MOCKERROR"); + errors.add(error); responseWrapper.setErrors(errors); - mockServer.expect(ExpectedCount.once(), - requestTo(new URI(validateUrl))) - .andExpect(method(HttpMethod.GET)) - .andRespond(withStatus(HttpStatus.OK) - .contentType(MediaType.APPLICATION_JSON) - .body(objectMapper.writeValueAsString(responseWrapper))); + mockServer.expect(ExpectedCount.once(), requestTo(new URI(validateUrl))).andExpect(method(HttpMethod.GET)) + .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON) + .body(objectMapper.writeValueAsString(responseWrapper))); Cookie cookie = new Cookie("Authorization", "mock_access_token"); - mockMvc.perform(get("/authorize/admin/validateToken").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isOk()) - .andExpect(jsonPath("$.errors[0].errorCode", is("MOCKERRORCODE"))); + mockMvc.perform(get("/authorize/admin/validateToken").contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().isOk()).andExpect(jsonPath("$.errors[0].errorCode", is("MOCKERRORCODE"))); } - + @Test public void logoutTest() throws Exception { - ResponseWrapper responseWrapper = new ResponseWrapper(); - MosipUserDto mosipUserDto = new MosipUserDto(); - mosipUserDto.setUserId("mock-user"); - mosipUserDto.setMail("mock-user@mosip.io"); - mosipUserDto.setMobile("9999999999"); - mosipUserDto.setRole("MOCK-ROLE"); - responseWrapper.setResponse(mosipUserDto); - - String mockToken="eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJzNmYxcDYwYWVDTTBrNy1NaW9sN0Zib2FTdXlRYm95UC03S1RUTmVWLWZNIn0.eyJqdGkiOiJmYTU4Y2NjMC00ZDRiLTQ2ZjAtYjgwOC0yMWI4ZTdhNmMxNDMiLCJleHAiOjE2NDAxODc3MTksIm5iZiI6MCwiaWF0IjoxNjQwMTUxNzE5LCJpc3MiOiJodHRwczovL2Rldi5tb3NpcC5uZXQva2V5Y2xvYWsvYXV0aC9yZWFsbXMvbW9zaXAiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiOWRiZTE0MDEtNTQ1NC00OTlhLTlhMWItNzVhZTY4M2Q0MjZhIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiY2QwYjU5NjEtOTYzMi00NmE0LWIzMzgtODc4MWEzNDVmMTZiIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwczovL2Rldi5tb3NpcC5uZXQiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIkNSRURFTlRJQUxfUkVRVUVTVCIsIlJFU0lERU5UIiwib2ZmbGluZV9hY2Nlc3MiLCJQQVJUTkVSX0FETUlOIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJtb3NpcC1yZXNpZGVudC1jbGllbnQiOnsicm9sZXMiOlsidW1hX3Byb3RlY3Rpb24iXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImNsaWVudEhvc3QiOiIxMC4yNDQuNS4xNDgiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImNsaWVudElkIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LW1vc2lwLXJlc2lkZW50LWNsaWVudCIsImNsaWVudEFkZHJlc3MiOiIxMC4yNDQuNS4xNDgifQ.xZq1m3mBTEvFDENKFOI59QsSl3sd_TSDNbhTAOq4x_x_4voPc4hh08gIxUdsVHfXY4T0P8DdZ1xNt8xd1VWc33Hc4b_3kK7ksGY4wwqtb0-pDLQGajCGuG6vebC1rYcjsGRbJ1Gnrj_F2RNY4Ky6Nq5SAJ1Lh_NVKNKFghAXb3YrlmqlmCB1fCltC4XBqNnF5_k4uzLCu_Wr0lt_M87X97DktaRGLOD2_HY1Ire9YPsWkoO8y7X_DRCY59yQDVgYs2nAiR6Am-c55Q0fEQ0HuB4IJHlhtMHm27dXPdOEhFhR8ZPOyeO6ZIcIm0ZTDjusrruqWy2_yO5fe3XIHkCOAw"; - mockServer.expect(ExpectedCount.once(), - requestTo(new URI("https://dev.mosip.net/keycloak/auth/realms/mosip/protocol/openid-connect/logout?id_token_hint="+mockToken))) - .andExpect(method(HttpMethod.GET)) - .andRespond(withStatus(HttpStatus.OK)); + String mockToken = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJzNmYxcDYwYWVDTTBrNy1NaW9sN0Zib2FTdXlRYm95UC03S1RUTmVWLWZNIn0.eyJqdGkiOiJmYTU4Y2NjMC00ZDRiLTQ2ZjAtYjgwOC0yMWI4ZTdhNmMxNDMiLCJleHAiOjE2NDAxODc3MTksIm5iZiI6MCwiaWF0IjoxNjQwMTUxNzE5LCJpc3MiOiJodHRwczovL2Rldi5tb3NpcC5uZXQva2V5Y2xvYWsvYXV0aC9yZWFsbXMvbW9zaXAiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiOWRiZTE0MDEtNTQ1NC00OTlhLTlhMWItNzVhZTY4M2Q0MjZhIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiY2QwYjU5NjEtOTYzMi00NmE0LWIzMzgtODc4MWEzNDVmMTZiIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwczovL2Rldi5tb3NpcC5uZXQiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIkNSRURFTlRJQUxfUkVRVUVTVCIsIlJFU0lERU5UIiwib2ZmbGluZV9hY2Nlc3MiLCJQQVJUTkVSX0FETUlOIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJtb3NpcC1yZXNpZGVudC1jbGllbnQiOnsicm9sZXMiOlsidW1hX3Byb3RlY3Rpb24iXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImNsaWVudEhvc3QiOiIxMC4yNDQuNS4xNDgiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImNsaWVudElkIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LW1vc2lwLXJlc2lkZW50LWNsaWVudCIsImNsaWVudEFkZHJlc3MiOiIxMC4yNDQuNS4xNDgifQ.xZq1m3mBTEvFDENKFOI59QsSl3sd_TSDNbhTAOq4x_x_4voPc4hh08gIxUdsVHfXY4T0P8DdZ1xNt8xd1VWc33Hc4b_3kK7ksGY4wwqtb0-pDLQGajCGuG6vebC1rYcjsGRbJ1Gnrj_F2RNY4Ky6Nq5SAJ1Lh_NVKNKFghAXb3YrlmqlmCB1fCltC4XBqNnF5_k4uzLCu_Wr0lt_M87X97DktaRGLOD2_HY1Ire9YPsWkoO8y7X_DRCY59yQDVgYs2nAiR6Am-c55Q0fEQ0HuB4IJHlhtMHm27dXPdOEhFhR8ZPOyeO6ZIcIm0ZTDjusrruqWy2_yO5fe3XIHkCOAw"; Cookie cookie = new Cookie("Authorization", mockToken); - mockMvc.perform(delete("/logout/user").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isOk()) - .andExpect(jsonPath("$.response.status", is("Success"))); + mockMvc.perform(get( + "/logout/user?redirecturi=" + CryptoUtil.encodeToURLSafeBase64("http://localhost:5000/".getBytes())) + .contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().is3xxRedirection()); } - - + + @Test public void logoutNullTokenTest() throws Exception { - ResponseWrapper responseWrapper = new ResponseWrapper(); - MosipUserDto mosipUserDto = new MosipUserDto(); - mosipUserDto.setUserId("mock-user"); - mosipUserDto.setMail("mock-user@mosip.io"); - mosipUserDto.setMobile("9999999999"); - mosipUserDto.setRole("MOCK-ROLE"); - responseWrapper.setResponse(mosipUserDto); - - String mockToken="eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJzNmYxcDYwYWVDTTBrNy1NaW9sN0Zib2FTdXlRYm95UC03S1RUTmVWLWZNIn0.eyJqdGkiOiJmYTU4Y2NjMC00ZDRiLTQ2ZjAtYjgwOC0yMWI4ZTdhNmMxNDMiLCJleHAiOjE2NDAxODc3MTksIm5iZiI6MCwiaWF0IjoxNjQwMTUxNzE5LCJpc3MiOiJodHRwczovL2Rldi5tb3NpcC5uZXQva2V5Y2xvYWsvYXV0aC9yZWFsbXMvbW9zaXAiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiOWRiZTE0MDEtNTQ1NC00OTlhLTlhMWItNzVhZTY4M2Q0MjZhIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiY2QwYjU5NjEtOTYzMi00NmE0LWIzMzgtODc4MWEzNDVmMTZiIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwczovL2Rldi5tb3NpcC5uZXQiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIkNSRURFTlRJQUxfUkVRVUVTVCIsIlJFU0lERU5UIiwib2ZmbGluZV9hY2Nlc3MiLCJQQVJUTkVSX0FETUlOIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJtb3NpcC1yZXNpZGVudC1jbGllbnQiOnsicm9sZXMiOlsidW1hX3Byb3RlY3Rpb24iXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImNsaWVudEhvc3QiOiIxMC4yNDQuNS4xNDgiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImNsaWVudElkIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LW1vc2lwLXJlc2lkZW50LWNsaWVudCIsImNsaWVudEFkZHJlc3MiOiIxMC4yNDQuNS4xNDgifQ.xZq1m3mBTEvFDENKFOI59QsSl3sd_TSDNbhTAOq4x_x_4voPc4hh08gIxUdsVHfXY4T0P8DdZ1xNt8xd1VWc33Hc4b_3kK7ksGY4wwqtb0-pDLQGajCGuG6vebC1rYcjsGRbJ1Gnrj_F2RNY4Ky6Nq5SAJ1Lh_NVKNKFghAXb3YrlmqlmCB1fCltC4XBqNnF5_k4uzLCu_Wr0lt_M87X97DktaRGLOD2_HY1Ire9YPsWkoO8y7X_DRCY59yQDVgYs2nAiR6Am-c55Q0fEQ0HuB4IJHlhtMHm27dXPdOEhFhR8ZPOyeO6ZIcIm0ZTDjusrruqWy2_yO5fe3XIHkCOAw"; - mockServer.expect(ExpectedCount.once(), - requestTo(new URI("https://dev.mosip.net/keycloak/auth/realms/mosip/protocol/openid-connect/logout?id_token_hint="+mockToken))) - .andExpect(method(HttpMethod.GET)) - .andRespond(withStatus(HttpStatus.OK)); - mockMvc.perform(delete("/logout/user").contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.errors[0].errorCode", is("KER-ACP-500")));; + mockMvc.perform(get( + "/logout/user?redirecturi=" + CryptoUtil.encodeToURLSafeBase64("http://localhost:5000/".getBytes())) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$.errors[0].errorCode", is(Errors.INVALID_TOKEN.getErrorCode()))); } - + @Test public void logoutServerErrorTokenTest() throws Exception { - ResponseWrapper responseWrapper = new ResponseWrapper(); - MosipUserDto mosipUserDto = new MosipUserDto(); - mosipUserDto.setUserId("mock-user"); - mosipUserDto.setMail("mock-user@mosip.io"); - mosipUserDto.setMobile("9999999999"); - mosipUserDto.setRole("MOCK-ROLE"); - responseWrapper.setResponse(mosipUserDto); - - String mockToken="eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJzNmYxcDYwYWVDTTBrNy1NaW9sN0Zib2FTdXlRYm95UC03S1RUTmVWLWZNIn0.eyJqdGkiOiJmYTU4Y2NjMC00ZDRiLTQ2ZjAtYjgwOC0yMWI4ZTdhNmMxNDMiLCJleHAiOjE2NDAxODc3MTksIm5iZiI6MCwiaWF0IjoxNjQwMTUxNzE5LCJpc3MiOiJodHRwczovL2Rldi5tb3NpcC5uZXQva2V5Y2xvYWsvYXV0aC9yZWFsbXMvbW9zaXAiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiOWRiZTE0MDEtNTQ1NC00OTlhLTlhMWItNzVhZTY4M2Q0MjZhIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiY2QwYjU5NjEtOTYzMi00NmE0LWIzMzgtODc4MWEzNDVmMTZiIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwczovL2Rldi5tb3NpcC5uZXQiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIkNSRURFTlRJQUxfUkVRVUVTVCIsIlJFU0lERU5UIiwib2ZmbGluZV9hY2Nlc3MiLCJQQVJUTkVSX0FETUlOIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJtb3NpcC1yZXNpZGVudC1jbGllbnQiOnsicm9sZXMiOlsidW1hX3Byb3RlY3Rpb24iXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImNsaWVudEhvc3QiOiIxMC4yNDQuNS4xNDgiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImNsaWVudElkIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LW1vc2lwLXJlc2lkZW50LWNsaWVudCIsImNsaWVudEFkZHJlc3MiOiIxMC4yNDQuNS4xNDgifQ.xZq1m3mBTEvFDENKFOI59QsSl3sd_TSDNbhTAOq4x_x_4voPc4hh08gIxUdsVHfXY4T0P8DdZ1xNt8xd1VWc33Hc4b_3kK7ksGY4wwqtb0-pDLQGajCGuG6vebC1rYcjsGRbJ1Gnrj_F2RNY4Ky6Nq5SAJ1Lh_NVKNKFghAXb3YrlmqlmCB1fCltC4XBqNnF5_k4uzLCu_Wr0lt_M87X97DktaRGLOD2_HY1Ire9YPsWkoO8y7X_DRCY59yQDVgYs2nAiR6Am-c55Q0fEQ0HuB4IJHlhtMHm27dXPdOEhFhR8ZPOyeO6ZIcIm0ZTDjusrruqWy2_yO5fe3XIHkCOAw"; - mockServer.expect(ExpectedCount.once(), - requestTo(new URI("https://dev.mosip.net/keycloak/auth/realms/mosip/protocol/openid-connect/logout?id_token_hint="+mockToken))) - .andExpect(method(HttpMethod.GET)) - .andRespond(withStatus(HttpStatus.BAD_REQUEST)); + + String mockToken = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJzNmYxcDYwYWVDTTBrNy1NaW9sN0Zib2FTdXlRYm95UC03S1RUTmVWLWZNIn0.eyJqdGkiOiJmYTU4Y2NjMC00ZDRiLTQ2ZjAtYjgwOC0yMWI4ZTdhNmMxNDMiLCJleHAiOjE2NDAxODc3MTksIm5iZiI6MCwiaWF0IjoxNjQwMTUxNzE5LCJpc3MiOiJodHRwczovL2Rldi5tb3NpcC5uZXQva2V5Y2xvYWsvYXV0aC9yZWFsbXMvbW9zaXAiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiOWRiZTE0MDEtNTQ1NC00OTlhLTlhMWItNzVhZTY4M2Q0MjZhIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiY2QwYjU5NjEtOTYzMi00NmE0LWIzMzgtODc4MWEzNDVmMTZiIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwczovL2Rldi5tb3NpcC5uZXQiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIkNSRURFTlRJQUxfUkVRVUVTVCIsIlJFU0lERU5UIiwib2ZmbGluZV9hY2Nlc3MiLCJQQVJUTkVSX0FETUlOIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJtb3NpcC1yZXNpZGVudC1jbGllbnQiOnsicm9sZXMiOlsidW1hX3Byb3RlY3Rpb24iXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImNsaWVudEhvc3QiOiIxMC4yNDQuNS4xNDgiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImNsaWVudElkIjoibW9zaXAtcmVzaWRlbnQtY2xpZW50IiwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LW1vc2lwLXJlc2lkZW50LWNsaWVudCIsImNsaWVudEFkZHJlc3MiOiIxMC4yNDQuNS4xNDgifQ.xZq1m3mBTEvFDENKFOI59QsSl3sd_TSDNbhTAOq4x_x_4voPc4hh08gIxUdsVHfXY4T0P8DdZ1xNt8xd1VWc33Hc4b_3kK7ksGY4wwqtb0-pDLQGajCGuG6vebC1rYcjsGRbJ1Gnrj_F2RNY4Ky6Nq5SAJ1Lh_NVKNKFghAXb3YrlmqlmCB1fCltC4XBqNnF5_k4uzLCu_Wr0lt_M87X97DktaRGLOD2_HY1Ire9YPsWkoO8y7X_DRCY59yQDVgYs2nAiR6Am-c55Q0fEQ0HuB4IJHlhtMHm27dXPdOEhFhR8ZPOyeO6ZIcIm0ZTDjusrruqWy2_yO5fe3XIHkCOAw"; Cookie cookie = new Cookie("Authorization", mockToken); - mockMvc.perform(delete("/logout/user").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isOk()) - .andExpect(jsonPath("$.errors[0].errorCode", isA(String.class))); + mockMvc.perform(get( + "/logout/user?redirecturi=" + CryptoUtil.encodeToURLSafeBase64("http://localhost:2000/".getBytes())).contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().isOk()).andExpect(jsonPath("$.errors[0].errorCode", is(Errors.ALLOWED_URL_EXCEPTION.getErrorCode()))); } - + @Test public void loginTest() throws Exception { @@ -212,94 +171,112 @@ public void loginTest() throws Exception { Cookie cookie = new Cookie("state", UUID.randomUUID().toString()); mockMvc.perform(get("/login/abc").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().is3xxRedirection()); } - + + @Test - public void logoutRedirectTest() throws Exception { + public void loginRedirectTest() throws Exception { AccessTokenResponse accessTokenResponse = new AccessTokenResponse(); accessTokenResponse.setAccess_token("mock-access-token"); accessTokenResponse.setExpires_in("111"); - - mockServer.expect(ExpectedCount.once(), - requestTo(new URI("http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/token"))) - .andExpect(method(HttpMethod.POST)) - .andRespond(withStatus(HttpStatus.OK) - .contentType(MediaType.APPLICATION_JSON) - .body(objectMapper.writeValueAsString(accessTokenResponse))); + + mockServer + .expect(ExpectedCount.once(), + requestTo(new URI( + "http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/token"))) + .andExpect(method(HttpMethod.POST)) + .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON) + .body(objectMapper.writeValueAsString(accessTokenResponse))); Cookie cookie = new Cookie("state", "mockstate"); - mockMvc.perform(get("/login-redirect/aHR0cDovL2xvY2FsaG9zdDo1MDAwLw==?state=mockstate&session_state=mock-session-state&code=mockcode").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().is3xxRedirection()); + mockMvc.perform(get( + "/login-redirect/aHR0cDovL2xvY2FsaG9zdDo1MDAwLw==?state=mockstate&session_state=mock-session-state&code=mockcode") + .contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().is3xxRedirection()); } - - + @Test - public void logoutRedirectTestWithHash() throws Exception { + public void loginRedirectTestWithHash() throws Exception { AccessTokenResponse accessTokenResponse = new AccessTokenResponse(); accessTokenResponse.setAccess_token("mock-access-token"); accessTokenResponse.setExpires_in("111"); - - mockServer.expect(ExpectedCount.once(), - requestTo(new URI("http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/token"))) - .andExpect(method(HttpMethod.POST)) - .andRespond(withStatus(HttpStatus.OK) - .contentType(MediaType.APPLICATION_JSON) - .body(objectMapper.writeValueAsString(accessTokenResponse))); + + mockServer + .expect(ExpectedCount.once(), + requestTo(new URI( + "http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/token"))) + .andExpect(method(HttpMethod.POST)) + .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON) + .body(objectMapper.writeValueAsString(accessTokenResponse))); Cookie cookie = new Cookie("state", "mockstate"); - mockMvc.perform(get("/login-redirect/aHR0cDovL2xvY2FsaG9zdDo1MDAwLyMvcmFuZG9tcGF0bS9yYW5kb21wYXRo?state=mockstate&session_state=mock-session-state&code=mockcode").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().is3xxRedirection()); + mockMvc.perform(get( + "/login-redirect/aHR0cDovL2xvY2FsaG9zdDo1MDAwLyMvcmFuZG9tcGF0bS9yYW5kb21wYXRo?state=mockstate&session_state=mock-session-state&code=mockcode") + .contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().is3xxRedirection()); } - + @Test - public void logoutServerExceptionRedirectTest() throws Exception { + public void loginServerExceptionRedirectTest() throws Exception { IAMErrorResponseDto errorResponseDto = new IAMErrorResponseDto(); errorResponseDto.setError("seerver error"); errorResponseDto.setError_description("sending mock error"); - - mockServer.expect(ExpectedCount.once(), - requestTo(new URI("http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/token"))) - .andExpect(method(HttpMethod.POST)) - .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.APPLICATION_JSON) - .body(objectMapper.writeValueAsString(errorResponseDto))); + + mockServer + .expect(ExpectedCount.once(), + requestTo(new URI( + "http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/token"))) + .andExpect(method(HttpMethod.POST)) + .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR).contentType(MediaType.APPLICATION_JSON) + .body(objectMapper.writeValueAsString(errorResponseDto))); Cookie cookie = new Cookie("state", "mockstate"); - mockMvc.perform(get("/login-redirect/abc?state=mockstate&session_state=mock-session-state&code=mockcode").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().is2xxSuccessful()).andExpect(jsonPath("$.errors[0].message", isA(String.class))); + mockMvc.perform(get("/login-redirect/abc?state=mockstate&session_state=mock-session-state&code=mockcode") + .contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().is2xxSuccessful()) + .andExpect(jsonPath("$.errors[0].message", isA(String.class))); } - + @Test public void loginUUIDEmptyTest() throws Exception { - //http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/auth?client_id=mosip-admin-client&redirect_uri=http://localhost:8082/v1/admin/login-redirect/abc&state=mock-state&response_type=code&scope=cls + // http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/auth?client_id=mosip-admin-client&redirect_uri=http://localhost:8082/v1/admin/login-redirect/abc&state=mock-state&response_type=code&scope=cls Cookie cookie = new Cookie("state", ""); - mockMvc.perform(get("/login/abc").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isOk()).andExpect(jsonPath("$.errors[0].errorCode", is(Errors.STATE_NULL_EXCEPTION.getErrorCode()))); + mockMvc.perform(get("/login/abc").contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors[0].errorCode", is(Errors.STATE_NULL_EXCEPTION.getErrorCode()))); } - + @Test public void loginUUIDNullTest() throws Exception { - //http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/auth?client_id=mosip-admin-client&redirect_uri=http://localhost:8082/v1/admin/login-redirect/abc&state=mock-state&response_type=code&scope=cls - mockMvc.perform(get("/login/abc").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(jsonPath("$.errors[0].errorCode", is(Errors.STATE_NULL_EXCEPTION.getErrorCode()))); + // http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/auth?client_id=mosip-admin-client&redirect_uri=http://localhost:8082/v1/admin/login-redirect/abc&state=mock-state&response_type=code&scope=cls + mockMvc.perform(get("/login/abc").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()) + .andExpect(jsonPath("$.errors[0].errorCode", is(Errors.STATE_NULL_EXCEPTION.getErrorCode()))); } - + @Test public void loginInvalidUUIDTest() throws Exception { - //http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/auth?client_id=mosip-admin-client&redirect_uri=http://localhost:8082/v1/admin/login-redirect/abc&state=mock-state&response_type=code&scope=cls + // http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/auth?client_id=mosip-admin-client&redirect_uri=http://localhost:8082/v1/admin/login-redirect/abc&state=mock-state&response_type=code&scope=cls Cookie cookie = new Cookie("state", "abc/nabc"); - mockMvc.perform(get("/login/abc").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isOk()).andExpect(jsonPath("$.errors[0].errorCode", is(Errors.STATE_NOT_UUID_EXCEPTION.getErrorCode()))); + mockMvc.perform(get("/login/abc").contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors[0].errorCode", is(Errors.STATE_NOT_UUID_EXCEPTION.getErrorCode()))); } - - - - + @Test public void logoutRedirectHostCheckTest() throws Exception { AccessTokenResponse accessTokenResponse = new AccessTokenResponse(); accessTokenResponse.setAccess_token("mock-access-token"); accessTokenResponse.setExpires_in("111"); - - mockServer.expect(ExpectedCount.once(), - requestTo(new URI("http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/token"))) - .andExpect(method(HttpMethod.POST)) - .andRespond(withStatus(HttpStatus.OK) - .contentType(MediaType.APPLICATION_JSON) - .body(objectMapper.writeValueAsString(accessTokenResponse))); + + mockServer + .expect(ExpectedCount.once(), + requestTo(new URI( + "http://localhost:8080/keycloak/auth/realms/mosip/protocol/openid-connect/token"))) + .andExpect(method(HttpMethod.POST)) + .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON) + .body(objectMapper.writeValueAsString(accessTokenResponse))); Cookie cookie = new Cookie("state", "mockstate"); - mockMvc.perform(get("/login-redirect/aHR0cDovL2FiOjUwMDAv?state=mockstate&session_state=mock-session-state&code=mockcode").contentType(MediaType.APPLICATION_JSON).cookie(cookie)).andExpect(status().isOk()).andExpect(jsonPath("$.errors[0].errorCode", is(Errors.ALLOWED_URL_EXCEPTION.getErrorCode())));; + mockMvc.perform(get( + "/login-redirect/aHR0cDovL2FiOjUwMDAv?state=mockstate&session_state=mock-session-state&code=mockcode") + .contentType(MediaType.APPLICATION_JSON).cookie(cookie)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors[0].errorCode", is(Errors.ALLOWED_URL_EXCEPTION.getErrorCode()))); + ; } - } diff --git a/kernel/kernel-authcodeflowproxy-api/src/test/resources/application-test.properties b/kernel/kernel-authcodeflowproxy-api/src/test/resources/application-test.properties index 9ef680b7db7..ccdc42f4d1e 100644 --- a/kernel/kernel-authcodeflowproxy-api/src/test/resources/application-test.properties +++ b/kernel/kernel-authcodeflowproxy-api/src/test/resources/application-test.properties @@ -39,4 +39,6 @@ mosip.iam.base-url=http://localhost:8080/keycloak mosip.iam.authorization_endpoint=${mosip.iam.base-url}/auth/realms/{realmId}/protocol/openid-connect/auth mosip.iam.token_endpoint=${mosip.iam.base-url}/auth/realms/{realmId}/protocol/openid-connect/token auth.allowed.urls=http://localhost:5000/ +mosip.iam.post-logout-uri-param-key=post_logout_redirect_uri +mosip.iam.end-session-endpoint-path=/protocol/openid-connect/logout diff --git a/kernel/kernel-bioapi-provider/pom.xml b/kernel/kernel-bioapi-provider/pom.xml index f86532b5905..e4bd1c94309 100644 --- a/kernel/kernel-bioapi-provider/pom.xml +++ b/kernel/kernel-bioapi-provider/pom.xml @@ -5,7 +5,7 @@ io.mosip.kernel kernel-bioapi-provider - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-bioapi-provider bioapi provider https://github.com/mosip/commons @@ -221,8 +221,8 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-biometrics-api/pom.xml b/kernel/kernel-biometrics-api/pom.xml index 9529bd4a362..66306922436 100644 --- a/kernel/kernel-biometrics-api/pom.xml +++ b/kernel/kernel-biometrics-api/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-biometrics-api - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-biometrics-api biometrics api definitions https://github.com/mosip/commons @@ -220,7 +220,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-biosdk-provider/pom.xml b/kernel/kernel-biosdk-provider/pom.xml index 52a68a33d4c..9ec047f1626 100644 --- a/kernel/kernel-biosdk-provider/pom.xml +++ b/kernel/kernel-biosdk-provider/pom.xml @@ -5,7 +5,7 @@ kernel-biosdk-provider io.mosip.kernel - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-biosdk-provider Implementation of biosdk provider https://github.com/mosip/commons @@ -118,9 +118,9 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-cbeffutil-api/pom.xml b/kernel/kernel-cbeffutil-api/pom.xml index 9d6cb82a2f6..9f7380e575d 100644 --- a/kernel/kernel-cbeffutil-api/pom.xml +++ b/kernel/kernel-cbeffutil-api/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.mosip.kernel kernel-cbeffutil-api - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -219,7 +219,7 @@ 1.4.2 1.4.2 true - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 @@ -243,7 +243,7 @@ io.mosip.kernel kernel-biometrics-api - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 diff --git a/kernel/kernel-core/pom.xml b/kernel/kernel-core/pom.xml index 436599f6a7c..a4833c17cc0 100644 --- a/kernel/kernel-core/pom.xml +++ b/kernel/kernel-core/pom.xml @@ -69,7 +69,7 @@ 2.9.5 2.9.8 - 2.12.0 + 2.12.7.1 20180130 2.2.10 20180813 @@ -120,7 +120,7 @@ **/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/verticle/**,**/spi/**,"**/proxy/**","**/entities/**","**/filter/**","**/util/**","**/verifier/**","**/jaxbclasses/**" kernel-core - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 org.springframework.boot diff --git a/kernel/kernel-core/src/main/java/io/mosip/kernel/core/authmanager/authadapter/spi/VertxAuthenticationProvider.java b/kernel/kernel-core/src/main/java/io/mosip/kernel/core/authmanager/authadapter/spi/VertxAuthenticationProvider.java index 028dfc1c3af..652dbccffb1 100644 --- a/kernel/kernel-core/src/main/java/io/mosip/kernel/core/authmanager/authadapter/spi/VertxAuthenticationProvider.java +++ b/kernel/kernel-core/src/main/java/io/mosip/kernel/core/authmanager/authadapter/spi/VertxAuthenticationProvider.java @@ -16,6 +16,8 @@ public interface VertxAuthenticationProvider { public void addAuthFilter(Router router, String path, HttpMethod httpMethod, String commaSepratedRoles); + public void addAuthFilter(RoutingContext routingContext, String commaSepratedRoles); + public String getContextUser(RoutingContext routingContext); } diff --git a/kernel/kernel-dataaccess-hibernate/pom.xml b/kernel/kernel-dataaccess-hibernate/pom.xml index 9f981a01c1d..fa32d20127d 100644 --- a/kernel/kernel-dataaccess-hibernate/pom.xml +++ b/kernel/kernel-dataaccess-hibernate/pom.xml @@ -216,12 +216,12 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 kernel-dataaccess-hibernate - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 io.mosip.kernel diff --git a/kernel/kernel-datamapper-orika/pom.xml b/kernel/kernel-datamapper-orika/pom.xml index 701266fe43d..4a4ae8dfa0e 100644 --- a/kernel/kernel-datamapper-orika/pom.xml +++ b/kernel/kernel-datamapper-orika/pom.xml @@ -7,7 +7,7 @@ io.mosip.kernel kernel-datamapper-orika - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-datamapper-orika http://maven.apache.org Mosip commons project @@ -223,7 +223,7 @@ 1.4.2 1.4.2 UTF-8 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-demographics-api/pom.xml b/kernel/kernel-demographics-api/pom.xml index e5e2916b063..1278fed8dd2 100644 --- a/kernel/kernel-demographics-api/pom.xml +++ b/kernel/kernel-demographics-api/pom.xml @@ -5,7 +5,7 @@ io.mosip.kernel kernel-demographics-api - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-demographics-api demographics api definitions https://github.com/mosip/commons @@ -221,7 +221,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idgenerator-machineid/pom.xml b/kernel/kernel-idgenerator-machineid/pom.xml index b6ff04eced0..2a1b3e00d9b 100644 --- a/kernel/kernel-idgenerator-machineid/pom.xml +++ b/kernel/kernel-idgenerator-machineid/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.mosip.kernel kernel-idgenerator-machineid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -217,11 +217,11 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idgenerator-mispid/pom.xml b/kernel/kernel-idgenerator-mispid/pom.xml index 95e8c146d07..59306aac48f 100644 --- a/kernel/kernel-idgenerator-mispid/pom.xml +++ b/kernel/kernel-idgenerator-mispid/pom.xml @@ -7,7 +7,7 @@ io.mosip.kernel kernel-idgenerator-mispid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-idgenerator-mispid Mosip commons project https://github.com/mosip/commons @@ -117,9 +117,9 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idgenerator-partnerid/pom.xml b/kernel/kernel-idgenerator-partnerid/pom.xml index 92feec0bca2..e046673cd6b 100644 --- a/kernel/kernel-idgenerator-partnerid/pom.xml +++ b/kernel/kernel-idgenerator-partnerid/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-idgenerator-partnerid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-idgenerator-partnerid Mosip commons project http://maven.apache.org @@ -219,9 +219,9 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idgenerator-prid/pom.xml b/kernel/kernel-idgenerator-prid/pom.xml index 4d47420ca15..7efbcb52500 100644 --- a/kernel/kernel-idgenerator-prid/pom.xml +++ b/kernel/kernel-idgenerator-prid/pom.xml @@ -217,15 +217,15 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 kernel-idgenerator-prid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 io.mosip.kernel diff --git a/kernel/kernel-idgenerator-regcenterid/pom.xml b/kernel/kernel-idgenerator-regcenterid/pom.xml index 59f1be3ee0a..aff3a7cacf2 100644 --- a/kernel/kernel-idgenerator-regcenterid/pom.xml +++ b/kernel/kernel-idgenerator-regcenterid/pom.xml @@ -215,15 +215,15 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 kernel-idgenerator-regcenterid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 io.mosip.kernel diff --git a/kernel/kernel-idgenerator-rid/pom.xml b/kernel/kernel-idgenerator-rid/pom.xml index d6a5c6b3898..6bf5a05ae8f 100644 --- a/kernel/kernel-idgenerator-rid/pom.xml +++ b/kernel/kernel-idgenerator-rid/pom.xml @@ -8,7 +8,7 @@ io.mosip.kernel kernel-idgenerator-rid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -115,8 +115,8 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idgenerator-service/pom.xml b/kernel/kernel-idgenerator-service/pom.xml index fe37f32eab0..229bb1b08e6 100644 --- a/kernel/kernel-idgenerator-service/pom.xml +++ b/kernel/kernel-idgenerator-service/pom.xml @@ -113,19 +113,19 @@ 1.4.2 1.4.2 UTF-8 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 1.3.2 3.4.1 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 2.3.7 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 **/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/verticle/**,**/spi/**,"**/proxy/**","**/entities/**","**/filter/**","**/util/**","**/verifier/**","**/IDGeneratorVertxApplication.java" kernel-idgenerator-service - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 io.mosip.kernel diff --git a/kernel/kernel-idgenerator-tokenid/pom.xml b/kernel/kernel-idgenerator-tokenid/pom.xml index b35db75e716..0d09d6bc5a2 100644 --- a/kernel/kernel-idgenerator-tokenid/pom.xml +++ b/kernel/kernel-idgenerator-tokenid/pom.xml @@ -6,7 +6,7 @@ 4.0.0 io.mosip.kernel kernel-idgenerator-tokenid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -218,9 +218,9 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idgenerator-vid/pom.xml b/kernel/kernel-idgenerator-vid/pom.xml index 9c4c9d2c261..47cab4a7b83 100644 --- a/kernel/kernel-idgenerator-vid/pom.xml +++ b/kernel/kernel-idgenerator-vid/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-idgenerator-vid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -216,9 +216,9 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idobjectvalidator/pom.xml b/kernel/kernel-idobjectvalidator/pom.xml index 52301718421..ec50e892fec 100644 --- a/kernel/kernel-idobjectvalidator/pom.xml +++ b/kernel/kernel-idobjectvalidator/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 kernel-idobjectvalidator - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 io.mosip.kernel UTF-8 @@ -216,7 +216,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idvalidator-mispid/pom.xml b/kernel/kernel-idvalidator-mispid/pom.xml index 8a75710961f..dba0459a54b 100644 --- a/kernel/kernel-idvalidator-mispid/pom.xml +++ b/kernel/kernel-idvalidator-mispid/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-idvalidator-mispid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -216,7 +216,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idvalidator-prid/pom.xml b/kernel/kernel-idvalidator-prid/pom.xml index 7a90d3877ff..30d48fa8050 100644 --- a/kernel/kernel-idvalidator-prid/pom.xml +++ b/kernel/kernel-idvalidator-prid/pom.xml @@ -216,11 +216,11 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 kernel-idvalidator-prid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-idvalidator-prid diff --git a/kernel/kernel-idvalidator-rid/pom.xml b/kernel/kernel-idvalidator-rid/pom.xml index 5968c422d13..d1194eccb5a 100644 --- a/kernel/kernel-idvalidator-rid/pom.xml +++ b/kernel/kernel-idvalidator-rid/pom.xml @@ -2,7 +2,7 @@ 4.0.0 io.mosip.kernel kernel-idvalidator-rid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-idvalidator-rid kernel-idvalidator-rid @@ -111,7 +111,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idvalidator-uin/pom.xml b/kernel/kernel-idvalidator-uin/pom.xml index cc5b5478ef7..945b163bce2 100644 --- a/kernel/kernel-idvalidator-uin/pom.xml +++ b/kernel/kernel-idvalidator-uin/pom.xml @@ -2,7 +2,7 @@ 4.0.0 io.mosip.kernel kernel-idvalidator-uin - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-idvalidator-uin kernel-idvalidator-uin @@ -111,7 +111,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-idvalidator-vid/pom.xml b/kernel/kernel-idvalidator-vid/pom.xml index 3bcd58ac252..0af5615fb3c 100644 --- a/kernel/kernel-idvalidator-vid/pom.xml +++ b/kernel/kernel-idvalidator-vid/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-idvalidator-vid - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-idvalidator-vid kernel-idvalidator-vid @@ -218,7 +218,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-licensekeygenerator-misp/pom.xml b/kernel/kernel-licensekeygenerator-misp/pom.xml index f995f73db64..b952d221371 100644 --- a/kernel/kernel-licensekeygenerator-misp/pom.xml +++ b/kernel/kernel-licensekeygenerator-misp/pom.xml @@ -6,7 +6,7 @@ 4.0.0 io.mosip.kernel kernel-licensekeygenerator-misp - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -218,7 +218,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-logger-logback/pom.xml b/kernel/kernel-logger-logback/pom.xml index 75cf922eefc..a487440c5cb 100644 --- a/kernel/kernel-logger-logback/pom.xml +++ b/kernel/kernel-logger-logback/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-logger-logback - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -216,7 +216,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-notification-service/pom.xml b/kernel/kernel-notification-service/pom.xml index e73df35e6e2..9f132c728f9 100644 --- a/kernel/kernel-notification-service/pom.xml +++ b/kernel/kernel-notification-service/pom.xml @@ -8,7 +8,7 @@ kernel-notification-service Mosip commons project https://github.com/mosip/commons - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 io.mosip.kernel UTF-8 @@ -221,11 +221,11 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 1.5.10 @@ -491,7 +491,7 @@ io.mosip.kernel kernel-smsserviceprovider-msg91 - 1.2.0.1-SNAPSHOT-rc1 + 1.2.0.1-B1-rc1 diff --git a/kernel/kernel-notification-service/src/main/java/io/mosip/kernel/emailnotification/service/impl/EmailNotificationServiceImpl.java b/kernel/kernel-notification-service/src/main/java/io/mosip/kernel/emailnotification/service/impl/EmailNotificationServiceImpl.java index 60794936bf0..c096a340877 100644 --- a/kernel/kernel-notification-service/src/main/java/io/mosip/kernel/emailnotification/service/impl/EmailNotificationServiceImpl.java +++ b/kernel/kernel-notification-service/src/main/java/io/mosip/kernel/emailnotification/service/impl/EmailNotificationServiceImpl.java @@ -51,6 +51,9 @@ public class EmailNotificationServiceImpl implements EmailNotificationio.mosip.kernel kernel-otpmanager-service - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 UTF-8 @@ -219,10 +219,10 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 1.5.10 diff --git a/kernel/kernel-pdfgenerator-itext/pom.xml b/kernel/kernel-pdfgenerator-itext/pom.xml index 1f10d091eff..9f38fd2d052 100644 --- a/kernel/kernel-pdfgenerator-itext/pom.xml +++ b/kernel/kernel-pdfgenerator-itext/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-pdfgenerator-itext - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-pdfgenerator generate pdf for given template @@ -218,7 +218,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-pinvalidator/pom.xml b/kernel/kernel-pinvalidator/pom.xml index 2f2cec8d61a..d7ab21b0c9b 100644 --- a/kernel/kernel-pinvalidator/pom.xml +++ b/kernel/kernel-pinvalidator/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-pinvalidator - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 http://maven.apache.org UTF-8 @@ -218,7 +218,7 @@ 1.4.2 1.4.2 UTF-8 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-pridgenerator-service/pom.xml b/kernel/kernel-pridgenerator-service/pom.xml index c7d6ad681a5..52d5f1502cb 100644 --- a/kernel/kernel-pridgenerator-service/pom.xml +++ b/kernel/kernel-pridgenerator-service/pom.xml @@ -215,16 +215,16 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 **/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/verticle/**,**/spi/**,"**/proxy/**","**/entities/**","**/filter/**","**/util/**","**/verifier/**","**/KernelPridgeneratorServiceApplication.java" kernel-pridgenerator-service - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 io.mosip.kernel diff --git a/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/config/PridServiceHealthCheckerhandler.java b/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/config/PridServiceHealthCheckerhandler.java index ab3f41df3b6..15b4c32b19b 100644 --- a/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/config/PridServiceHealthCheckerhandler.java +++ b/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/config/PridServiceHealthCheckerhandler.java @@ -17,6 +17,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import io.mosip.kernel.pridgenerator.constant.EventType; import io.mosip.kernel.pridgenerator.constant.HibernatePersistenceConstant; import io.mosip.kernel.pridgenerator.constant.PRIDGeneratorConstant; import io.mosip.kernel.pridgenerator.constant.PRIDHealthConstants; @@ -156,7 +157,7 @@ public void dispSpaceHealthChecker(Future future) { */ public void verticleHealthHandler(Future future, Vertx vertx) { - vertx.eventBus().send(PRIDGeneratorConstant.PRID_GENERATOR_ADDRESS, PRIDHealthConstants.PING, response -> { + vertx.eventBus().send(EventType.CHECKPOOL, PRIDHealthConstants.PING, response -> { if (response.succeeded()) { final JsonObject result = resultBuilder.create() diff --git a/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/verticle/PridFetcherVerticle.java b/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/verticle/PridFetcherVerticle.java index 661518d3c0d..1268046e5db 100644 --- a/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/verticle/PridFetcherVerticle.java +++ b/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/verticle/PridFetcherVerticle.java @@ -67,7 +67,7 @@ public void start(Future future) { .produces(PRIDGeneratorConstant.APPLICATION_JSON); // mount all the routers to parent router parentRouter.mountSubRouter(environment.getProperty(PRIDGeneratorConstant.SERVER_SERVLET_PATH), metricRouter); - parentRouter.mountSubRouter(environment.getProperty(PRIDGeneratorConstant.SERVER_SERVLET_PATH), healthCheckRouter); + parentRouter.get(environment.getProperty(PRIDGeneratorConstant.SERVER_SERVLET_PATH)+PRIDGeneratorConstant.HEALTH_ENDPOINT).handler(healthCheckHandler); parentRouter.mountSubRouter( environment.getProperty(PRIDGeneratorConstant.SERVER_SERVLET_PATH) + PRIDGeneratorConstant.PRID, pridFetcherRouter.createRouter(vertx)); diff --git a/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/verticle/PridPoolCheckerVerticle.java b/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/verticle/PridPoolCheckerVerticle.java index 442b5642af4..1e6da673cc4 100644 --- a/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/verticle/PridPoolCheckerVerticle.java +++ b/kernel/kernel-pridgenerator-service/src/main/java/io/mosip/kernel/pridgenerator/verticle/PridPoolCheckerVerticle.java @@ -6,6 +6,7 @@ import org.springframework.core.env.Environment; import io.mosip.kernel.pridgenerator.constant.EventType; +import io.mosip.kernel.pridgenerator.constant.PRIDHealthConstants; import io.mosip.kernel.pridgenerator.constant.PridLifecycleStatus; import io.mosip.kernel.pridgenerator.service.PridService; import io.vertx.core.AbstractVerticle; @@ -64,6 +65,7 @@ public void start(Future startFuture) { LOGGER.info("event type is send {} eventBus{}", handler.isSend(), eventBus); LOGGER.info("locked generation"); } + handler.reply(PRIDHealthConstants.ACTIVE); }); MessageConsumer initPoolConsumer = eventBus.consumer(EventType.INITPOOL); diff --git a/kernel/kernel-qrcodegenerator-zxing/pom.xml b/kernel/kernel-qrcodegenerator-zxing/pom.xml index 7fd4ab3efb9..43c9864636f 100644 --- a/kernel/kernel-qrcodegenerator-zxing/pom.xml +++ b/kernel/kernel-qrcodegenerator-zxing/pom.xml @@ -6,7 +6,7 @@ io.mosip.kernel kernel-qrcodegenerator-zxing - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 jar kernel-qrcodegenerator-zxing @@ -221,7 +221,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-ridgenerator-service/pom.xml b/kernel/kernel-ridgenerator-service/pom.xml index 6971ec678ef..5e22438fffe 100644 --- a/kernel/kernel-ridgenerator-service/pom.xml +++ b/kernel/kernel-ridgenerator-service/pom.xml @@ -7,7 +7,7 @@ io.mosip.kernel kernel-ridgenerator-service - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel-ridgenerator-service Mosip commons project https://github.com/mosip/commons @@ -117,10 +117,10 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 + 1.2.0.1-B1 0.8.5 1.5.10 diff --git a/kernel/kernel-salt-generator/pom.xml b/kernel/kernel-salt-generator/pom.xml index 759c16780cc..adebd43eb53 100644 --- a/kernel/kernel-salt-generator/pom.xml +++ b/kernel/kernel-salt-generator/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-salt-generator - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 Kernel Salt Generator Batch Job Application to for one-time populating of salt values for MOSIP related application salt tables. https://github.com/mosip/commons @@ -219,8 +219,8 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 + 1.2.0.1-B1 2.0.2.RELEASE 2.0.0.RELEASE 42.2.2 diff --git a/kernel/kernel-templatemanager-velocity/pom.xml b/kernel/kernel-templatemanager-velocity/pom.xml index ecb126ab83d..28f3970f14d 100644 --- a/kernel/kernel-templatemanager-velocity/pom.xml +++ b/kernel/kernel-templatemanager-velocity/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-templatemanager-velocity - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 Mosip Template Manager Using Velocity Template Engine UTF-8 @@ -218,7 +218,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-transliteration-icu4j/pom.xml b/kernel/kernel-transliteration-icu4j/pom.xml index 74edc370aaa..6c61f045937 100644 --- a/kernel/kernel-transliteration-icu4j/pom.xml +++ b/kernel/kernel-transliteration-icu4j/pom.xml @@ -7,7 +7,7 @@ io.mosip.kernel kernel-transliteration-icu4j jar - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 kernel transliteration icu4j https://github.com/mosip/commons kernel-transliteration-icu4j @@ -118,7 +118,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 diff --git a/kernel/kernel-websubclient-api/pom.xml b/kernel/kernel-websubclient-api/pom.xml index 3170d35d6a2..4eaa84bfcab 100644 --- a/kernel/kernel-websubclient-api/pom.xml +++ b/kernel/kernel-websubclient-api/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip.kernel kernel-websubclient-api - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 jar kernel-websubclient-api Mosip commons project @@ -220,7 +220,7 @@ 1.8.12 1.4.2 1.4.2 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 0.8.5 1.2.3 diff --git a/kernel/pom.xml b/kernel/pom.xml index dc0a4b9f165..5b6439138a1 100644 --- a/kernel/pom.xml +++ b/kernel/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 io.mosip.kernel kernel-parent pom diff --git a/pom.xml b/pom.xml index 664ba20f12f..d46d7ff237c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip commons - 1.2.0.1-SNAPSHOT + 1.2.0.1-B1 pom MOSIP Commons Parent POM