From ddf9d403f57bef791bbed9509a0b0f488af38ee6 Mon Sep 17 00:00:00 2001 From: ashirwadadayarathne Date: Tue, 7 Jan 2025 11:09:04 +0530 Subject: [PATCH 1/2] Configuring different super admins for each server --- .../accelerators/fs-apim/bin/configure.ps1 | 12 ++++++++++++ .../accelerators/fs-apim/bin/configure.sh | 6 ++++++ .../fs-apim/repository/conf/configure.properties | 5 +++++ .../resources/wso2am-4.4.0-deployment.toml | 6 +++--- .../accelerators/fs-is/bin/configure.ps1 | 11 +++++++++++ .../accelerators/fs-is/bin/configure.sh | 4 ++++ .../repository/conf/financial-services.xml | 2 +- .../repository/conf/financial-services.xml.j2 | 2 +- .../fs-is/repository/conf/configure.properties | 4 ++++ .../resources/wso2is-7.0.0-deployment.toml | 4 ++-- 10 files changed, 49 insertions(+), 7 deletions(-) diff --git a/financial-services-accelerator/accelerators/fs-apim/bin/configure.ps1 b/financial-services-accelerator/accelerators/fs-apim/bin/configure.ps1 index ea57e597..9efe88e6 100644 --- a/financial-services-accelerator/accelerators/fs-apim/bin/configure.ps1 +++ b/financial-services-accelerator/accelerators/fs-apim/bin/configure.ps1 @@ -141,6 +141,13 @@ Function Set-Hostnames { Find-Replace $DEPLOYMENT_TOML_FILE "IS_HOSTNAME" "$( $PROPERTIES.'IS_HOSTNAME' )" } +# A function to replace the admin credentials in the temp deployment.toml with their actual values from configure.properties +Function Set-Admin-Credentials { + Find-Replace $DEPLOYMENT_TOML_FILE "APIM_ADMIN_USERNAME" "$( $PROPERTIES.'APIM_ADMIN_USERNAME' )" + Find-Replace $DEPLOYMENT_TOML_FILE "APIM_ADMIN_PASSWORD" "$( $PROPERTIES.'APIM_ADMIN_PASSWORD' )" + Find-Replace $DEPLOYMENT_TOML_FILE "APIM_ADMIN_NAME" "$( $PROPERTIES.'APIM_ADMIN_NAME' )" +} + # A utility function to create a database. Function Add-Database { param ([string]$DB_USER, [string]$DB_PASS, [string]$DB_HOST, [string]$DB_NAME) @@ -224,6 +231,11 @@ Write-Output "[INFO] Configuring the hostnames..." Set-Hostnames Write-Output "[INFO] Hostnames configurations completed!" +Write-Output "============================================" +Write-Output "[INFO] Configuring the admin credentials..." +Set-Admin-Credentials +Write-Output "[INFO] Admin credentials configurations completed!" + Write-Output "============================================" Write-Output "[INFO] Configuring the datasources..." Set-Datasources diff --git a/financial-services-accelerator/accelerators/fs-apim/bin/configure.sh b/financial-services-accelerator/accelerators/fs-apim/bin/configure.sh index a15b01e7..068ff035 100755 --- a/financial-services-accelerator/accelerators/fs-apim/bin/configure.sh +++ b/financial-services-accelerator/accelerators/fs-apim/bin/configure.sh @@ -137,6 +137,12 @@ echo -e "================================================\n" sed -i -e 's|APIM_HOSTNAME|'${APIM_HOSTNAME}'|g' ${DEPLOYMENT_TOML_FILE} sed -i -e 's|IS_HOSTNAME|'${IS_HOSTNAME}'|g' ${DEPLOYMENT_TOML_FILE} +echo -e "\nReplace admin credentials \n" +echo -e "================================================\n" +sed -i -e 's|APIM_ADMIN_USERNAME|'${APIM_ADMIN_USERNAME}'|g' ${DEPLOYMENT_TOML_FILE} +sed -i -e 's|APIM_ADMIN_PASSWORD|'${APIM_ADMIN_PASSWORD}'|g' ${DEPLOYMENT_TOML_FILE} +sed -i -e 's|APIM_ADMIN_NAME|'${APIM_ADMIN_NAME}'|g' ${DEPLOYMENT_TOML_FILE} + echo -e "\nConfigure datasources \n" echo -e "================================================\n" configure_datasources; diff --git a/financial-services-accelerator/accelerators/fs-apim/repository/conf/configure.properties b/financial-services-accelerator/accelerators/fs-apim/repository/conf/configure.properties index 03e11874..a5e59ced 100644 --- a/financial-services-accelerator/accelerators/fs-apim/repository/conf/configure.properties +++ b/financial-services-accelerator/accelerators/fs-apim/repository/conf/configure.properties @@ -19,6 +19,11 @@ APIM_HOSTNAME=localhost IS_HOSTNAME=localhost BI_HOSTNAME=localhost +# Specify the super admin credentials you want to configure +APIM_ADMIN_USERNAME=am_admin@wso2.com +APIM_ADMIN_PASSWORD=wso2123 +APIM_ADMIN_NAME=am_admin + # Specify the deployment.toml file containing the required configurations based on the APIM version being used # As an example if APIM 4.3.0 version is used change the file name to wso2am-4.3.0-deployment.toml in the same file path PRODUCT_CONF_PATH=repository/resources/wso2am-4.4.0-deployment.toml diff --git a/financial-services-accelerator/accelerators/fs-apim/repository/resources/wso2am-4.4.0-deployment.toml b/financial-services-accelerator/accelerators/fs-apim/repository/resources/wso2am-4.4.0-deployment.toml index f489441e..b5fab3f8 100755 --- a/financial-services-accelerator/accelerators/fs-apim/repository/resources/wso2am-4.4.0-deployment.toml +++ b/financial-services-accelerator/accelerators/fs-apim/repository/resources/wso2am-4.4.0-deployment.toml @@ -6,8 +6,8 @@ base_path = "${carbon.protocol}://${carbon.host}:${carbon.management.port}" server_role = "default" [super_admin] -username = "admin@wso2.com" -password = "wso2123" +username = "APIM_ADMIN_USERNAME" +password = "APIM_ADMIN_PASSWORD" create_admin_account = true [tenant_mgt] @@ -270,7 +270,7 @@ username = "$ref{super_admin.username}@carbon.super" [apim.throttling.jms] password = "$ref{super_admin.password}" -username = "admin!wso2.com!carbon.super" +username = "APIM_ADMIN_NAME!wso2.com!carbon.super" #start_delay = "5m" #[apim.throttling.event_sync] diff --git a/financial-services-accelerator/accelerators/fs-is/bin/configure.ps1 b/financial-services-accelerator/accelerators/fs-is/bin/configure.ps1 index db7900bc..23dc29f2 100644 --- a/financial-services-accelerator/accelerators/fs-is/bin/configure.ps1 +++ b/financial-services-accelerator/accelerators/fs-is/bin/configure.ps1 @@ -144,6 +144,12 @@ Function Set-Hostnames { Find-Replace $DEPLOYMENT_TOML_FILE "BI_HOSTNAME" "$( $PROPERTIES.'BI_HOSTNAME' )" } +# A function to replace the admin credentials in the temp deployment.toml with their actual values from configure.properties +Function Set-Admin-Credentials { + Find-Replace $DEPLOYMENT_TOML_FILE "IS_ADMIN_USERNAME" "$( $PROPERTIES.'IS_ADMIN_USERNAME' )" + Find-Replace $DEPLOYMENT_TOML_FILE "IS_ADMIN_PASSWORD" "$( $PROPERTIES.'IS_ADMIN_PASSWORD' )" +} + # A utility function to create a database. Function Add-Database { param ([string]$DB_USER, [string]$DB_PASS, [string]$DB_HOST, [string]$DB_NAME) @@ -200,6 +206,11 @@ Write-Output "[INFO] Configuring the hostnames..." Set-Hostnames Write-Output "[INFO] Hostnames configurations completed!" +Write-Output "============================================" +Write-Output "[INFO] Configuring the admin credentials..." +Set-Admin-Credentials +Write-Output "[INFO] Admin credentials configurations completed!" + Write-Output "============================================" Write-Output "[INFO] Configuring the datasources..." Set-Datasources diff --git a/financial-services-accelerator/accelerators/fs-is/bin/configure.sh b/financial-services-accelerator/accelerators/fs-is/bin/configure.sh index 2716e9a8..5a23e7e1 100755 --- a/financial-services-accelerator/accelerators/fs-is/bin/configure.sh +++ b/financial-services-accelerator/accelerators/fs-is/bin/configure.sh @@ -134,6 +134,10 @@ echo -e "================================================\n" sed -i -e 's|IS_HOSTNAME|'${IS_HOSTNAME}'|g' ${DEPLOYMENT_TOML_FILE} sed -i -e 's|APIM_HOSTNAME|'${APIM_HOSTNAME}'|g' ${DEPLOYMENT_TOML_FILE} +echo -e "\nReplace admin credentials \n" +echo -e "================================================\n" +sed -i -e 's|IS_ADMIN_USERNAME|'${IS_ADMIN_USERNAME}'|g' ${DEPLOYMENT_TOML_FILE} +sed -i -e 's|IS_ADMIN_PASSWORD|'${IS_ADMIN_PASSWORD}'|g' ${DEPLOYMENT_TOML_FILE} echo -e "\nConfigure datasources \n" echo -e "================================================\n" diff --git a/financial-services-accelerator/accelerators/fs-is/carbon-home/repository/conf/financial-services.xml b/financial-services-accelerator/accelerators/fs-is/carbon-home/repository/conf/financial-services.xml index 4177a2d0..af6048ca 100644 --- a/financial-services-accelerator/accelerators/fs-is/carbon-home/repository/conf/financial-services.xml +++ b/financial-services-accelerator/accelerators/fs-is/carbon-home/repository/conf/financial-services.xml @@ -41,7 +41,7 @@ org.wso2.financial.services.accelerator.consent.mgt.extensions.admin.impl.DefaultConsentAdminHandler - admin@wso2.com + is_admin@wso2.com wso2123 diff --git a/financial-services-accelerator/accelerators/fs-is/carbon-home/repository/resources/conf/templates/repository/conf/financial-services.xml.j2 b/financial-services-accelerator/accelerators/fs-is/carbon-home/repository/resources/conf/templates/repository/conf/financial-services.xml.j2 index 92ada121..cfd2ac4b 100644 --- a/financial-services-accelerator/accelerators/fs-is/carbon-home/repository/resources/conf/templates/repository/conf/financial-services.xml.j2 +++ b/financial-services-accelerator/accelerators/fs-is/carbon-home/repository/resources/conf/templates/repository/conf/financial-services.xml.j2 @@ -91,7 +91,7 @@ {% if financial_services.consent.api_credentials.username is defined %} {{financial_services.consent.api_credentials.username}} {% else %} - admin@wso2.com + is_admin@wso2.com {% endif %} {% if financial_services.consent.api_credentials.password is defined %} {{financial_services.consent.api_credentials.password}} diff --git a/financial-services-accelerator/accelerators/fs-is/repository/conf/configure.properties b/financial-services-accelerator/accelerators/fs-is/repository/conf/configure.properties index 7f06c338..9ea08d73 100644 --- a/financial-services-accelerator/accelerators/fs-is/repository/conf/configure.properties +++ b/financial-services-accelerator/accelerators/fs-is/repository/conf/configure.properties @@ -20,6 +20,10 @@ APIM_HOSTNAME=localhost BI_HOSTNAME=localhost IS_PRODUCT=wso2is-7.0.0 +# Specify the super admin credentials you want to configure +IS_ADMIN_USERNAME=is_admin@wso2.com +IS_ADMIN_PASSWORD=wso2123 + # Specify the deployment.toml file containing the required configurations based on the IS version being used # As an example if IS 7.0.0 version is used change the file name to wso2is-7.0.0-deployment.toml in the same file path PRODUCT_CONF_PATH=repository/resources/wso2is-7.0.0-deployment.toml diff --git a/financial-services-accelerator/accelerators/fs-is/repository/resources/wso2is-7.0.0-deployment.toml b/financial-services-accelerator/accelerators/fs-is/repository/resources/wso2is-7.0.0-deployment.toml index 27696cce..0f09a84f 100644 --- a/financial-services-accelerator/accelerators/fs-is/repository/resources/wso2is-7.0.0-deployment.toml +++ b/financial-services-accelerator/accelerators/fs-is/repository/resources/wso2is-7.0.0-deployment.toml @@ -12,8 +12,8 @@ enable_email_domain = true #================configs related to user-mgt.xml============= [super_admin] -username = "admin@wso2.com" -password = "wso2123" +username = "IS_ADMIN_USERNAME" +password = "IS_ADMIN_PASSWORD" create_admin_account = true [realm_manager] From 5e248cf31a4f88a33d363a4ced9106dca8ed94d9 Mon Sep 17 00:00:00 2001 From: ashirwadadayarathne Date: Tue, 7 Jan 2025 11:12:27 +0530 Subject: [PATCH 2/2] Configuring different super admins for each server --- .../accelerators/fs-apim/bin/configure.ps1 | 4 ++-- .../accelerators/fs-is/bin/configure.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/financial-services-accelerator/accelerators/fs-apim/bin/configure.ps1 b/financial-services-accelerator/accelerators/fs-apim/bin/configure.ps1 index 9efe88e6..08013260 100644 --- a/financial-services-accelerator/accelerators/fs-apim/bin/configure.ps1 +++ b/financial-services-accelerator/accelerators/fs-apim/bin/configure.ps1 @@ -142,7 +142,7 @@ Function Set-Hostnames { } # A function to replace the admin credentials in the temp deployment.toml with their actual values from configure.properties -Function Set-Admin-Credentials { +Function Set-AdminCredentials { Find-Replace $DEPLOYMENT_TOML_FILE "APIM_ADMIN_USERNAME" "$( $PROPERTIES.'APIM_ADMIN_USERNAME' )" Find-Replace $DEPLOYMENT_TOML_FILE "APIM_ADMIN_PASSWORD" "$( $PROPERTIES.'APIM_ADMIN_PASSWORD' )" Find-Replace $DEPLOYMENT_TOML_FILE "APIM_ADMIN_NAME" "$( $PROPERTIES.'APIM_ADMIN_NAME' )" @@ -233,7 +233,7 @@ Write-Output "[INFO] Hostnames configurations completed!" Write-Output "============================================" Write-Output "[INFO] Configuring the admin credentials..." -Set-Admin-Credentials +Set-AdminCredentials Write-Output "[INFO] Admin credentials configurations completed!" Write-Output "============================================" diff --git a/financial-services-accelerator/accelerators/fs-is/bin/configure.ps1 b/financial-services-accelerator/accelerators/fs-is/bin/configure.ps1 index 23dc29f2..375de542 100644 --- a/financial-services-accelerator/accelerators/fs-is/bin/configure.ps1 +++ b/financial-services-accelerator/accelerators/fs-is/bin/configure.ps1 @@ -145,7 +145,7 @@ Function Set-Hostnames { } # A function to replace the admin credentials in the temp deployment.toml with their actual values from configure.properties -Function Set-Admin-Credentials { +Function Set-AdminCredentials { Find-Replace $DEPLOYMENT_TOML_FILE "IS_ADMIN_USERNAME" "$( $PROPERTIES.'IS_ADMIN_USERNAME' )" Find-Replace $DEPLOYMENT_TOML_FILE "IS_ADMIN_PASSWORD" "$( $PROPERTIES.'IS_ADMIN_PASSWORD' )" } @@ -208,7 +208,7 @@ Write-Output "[INFO] Hostnames configurations completed!" Write-Output "============================================" Write-Output "[INFO] Configuring the admin credentials..." -Set-Admin-Credentials +Set-AdminCredentials Write-Output "[INFO] Admin credentials configurations completed!" Write-Output "============================================"