Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashi1993 committed Sep 30, 2024
2 parents 43090a2 + ccaa8bc commit e1c7fe0
Show file tree
Hide file tree
Showing 40 changed files with 383 additions and 2,301 deletions.
14 changes: 7 additions & 7 deletions financial-services-accelerator/accelerators/fs-apim/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
### **WSO2 Open Banking APIM Accelerator 3.0.0**
### **WSO2 Financial Services APIM Accelerator 4.0.0**

**Try Locally:**

Prerequisites:
1. [Download](https://wso2.com/api-manager/#) the WSO2 API Manager product
2. Build the repository completely using the below command to create accelerator zip files.
<code>mvn clean install -PSolution</code>
3. Locate the Accelerator Zip file (wso2-obam-accelerator-3.0.0.zip) from
<code>mvn clean install -P Solution</code>
3. Locate the Accelerator Zip file (wso2-fsam-accelerator-4.0.0.zip) from
the <code>target</code> folder in this directory
4. Setup MySQL database server
5. Install Java on your local machine

Below are the simplified steps to install the WSO2 Open Banking Accelerator. For more information,
Below are the simplified steps to install the WSO2 Financial Services Accelerator. For more information,
please refer to [Quick Start Guide](https://ob.docs.wso2.com/en/latest/get-started/quick-start-guide/) or
to [ Complete install and Setup Guide ](https://ob.docs.wso2.com/en/latest/install-and-setup/)

Steps:
1. Extract the Base product (WSO2 API Manager product) to a preferred location (<WSO2_APIM_HOME>)
2. Extract WSO2 OB APIM Accelerator (wso2-obam-accelerator-3.0.0.zip) to WSO2_APIM_HOME
3. Run <WSO2_OB_APIM_ACC_HOME>/bin/merge.sh. This will copy/install the Open Banking artifacts to
2. Extract WSO2 FS APIM Accelerator (wso2-fsam-accelerator-4.0.0.zip) to WSO2_APIM_HOME
3. Run <WSO2_FS_APIM_ACC_HOME>/bin/merge.sh. This will copy/install the Financial Services artifacts to
the WSO2 API Manager product
4. Run <WSO2_OB_APIM_ACC_HOME>/bin/configure.sh. This will configure the server and create databases and tables.
4. Run <WSO2_FS_APIM_ACC_HOME>/bin/configure.sh. This will configure the server and create databases and tables.
5. Run <WSO2_APIM_HOME>/bin/wso2server.sh to start the server.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ Function Find-Replace {

# Get the root directory location of the accelerator. Which is <BASE_PRODUCT>/<ACCELERATOR>/
Set-Location (Join-Path $PSScriptRoot ".\..\")
$WSO2_OB_ACCELERATOR_HOME = (Get-Location).path
Write-Output "[INFO] Accelerator Home : $WSO2_OB_ACCELERATOR_HOME"
$WSO2_FS_ACCELERATOR_HOME = (Get-Location).path
Write-Output "[INFO] Accelerator Home : $WSO2_FS_ACCELERATOR_HOME"

# Get the root directory of the base product.
if ($null -eq $WSO2_BASE_PRODUCT_HOME) {
Set-Location (Join-Path $WSO2_OB_ACCELERATOR_HOME ".\..\")
Set-Location (Join-Path $WSO2_FS_ACCELERATOR_HOME ".\..\")
$WSO2_BASE_PRODUCT_HOME = (Get-Location).path
}
Write-Output "[INFO] Base Product Home : $WSO2_BASE_PRODUCT_HOME"
Expand All @@ -90,16 +90,16 @@ if (-NOT(Test-Path (Join-Path $WSO2_BASE_PRODUCT_HOME "repository\components")))
}

# Get the location of the configure.properties
$CONFIG_PROPERTIES_PATH = Join-Path $WSO2_OB_ACCELERATOR_HOME "repository\conf\configure.properties"
$CONFIG_PROPERTIES_PATH = Join-Path $WSO2_FS_ACCELERATOR_HOME "repository\conf\configure.properties"
Write-Output "[INFO] configure.properties location : $CONFIG_PROPERTIES_PATH"

# Load the variables in the configure.properties file
$PROPERTIES = ConvertFrom-StringData (Get-Content $CONFIG_PROPERTIES_PATH -raw)

$SELECTED_DEPLOYMENT_TOML_FILE = Join-Path $WSO2_OB_ACCELERATOR_HOME $PROPERTIES.'PRODUCT_CONF_PATH'
$SELECTED_DEPLOYMENT_TOML_FILE = Join-Path $WSO2_FS_ACCELERATOR_HOME $PROPERTIES.'PRODUCT_CONF_PATH'
Write-Output "[INFO] Selected deployment.toml location : $SELECTED_DEPLOYMENT_TOML_FILE"

$DEPLOYMENT_TOML_FILE = Join-Path $WSO2_OB_ACCELERATOR_HOME "repository\resources\deployment.toml"
$DEPLOYMENT_TOML_FILE = Join-Path $WSO2_FS_ACCELERATOR_HOME "repository\resources\deployment.toml"
# Temporary copy the selected toml file so we can make changes to it.
Copy-Item -Path $SELECTED_DEPLOYMENT_TOML_FILE $DEPLOYMENT_TOML_FILE
Write-Output "[INFO] Temporary deployment.toml location : $DEPLOYMENT_TOML_FILE"
Expand Down Expand Up @@ -139,7 +139,6 @@ Function Set-Datasources
Function Set-Hostnames {
Find-Replace $DEPLOYMENT_TOML_FILE "APIM_HOSTNAME" "$( $PROPERTIES.'APIM_HOSTNAME' )"
Find-Replace $DEPLOYMENT_TOML_FILE "IS_HOSTNAME" "$( $PROPERTIES.'IS_HOSTNAME' )"
Find-Replace $DEPLOYMENT_TOML_FILE "BI_HOSTNAME" "$( $PROPERTIES.'BI_HOSTNAME' )"
}

# A utility function to create a database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@
# under the License.

# command to execute
# ./merge.sh <WSO2_OB_APIM_HOME>
# ./merge.sh <WSO2_APIM_HOME>

source $(pwd)/../repository/conf/configure.properties
WSO2_OB_APIM_HOME=$1
WSO2_APIM_HOME=$1

# set accelerator home
cd ../
ACCELERATOR_HOME=$(pwd)
echo "Accelerator Home: ${ACCELERATOR_HOME}"

# set product home
if [ "${WSO2_OB_APIM_HOME}" == "" ]
if [ "${WSO2_APIM_HOME}" == "" ]
then
cd ../
WSO2_OB_APIM_HOME=$(pwd)
echo "Product Home: ${WSO2_OB_APIM_HOME}"
WSO2_APIM_HOME=$(pwd)
echo "Product Home: ${WSO2_APIM_HOME}"
fi

# validate product home
if [ ! -d "${WSO2_OB_APIM_HOME}/repository/components" ]; then
if [ ! -d "${WSO2_APIM_HOME}/repository/components" ]; then
echo -e "\n\aERROR:specified product path is not a valid carbon product path\n";
exit 2;
else
Expand Down Expand Up @@ -86,7 +86,7 @@ create_databases() {

echo -e "\nUpdate am_application_registration table input field size (temporary)"
echo -e "=======================================================================\n"
sed -i -e 's|INPUTS VARCHAR(1000)|INPUTS VARCHAR(7500)|g' ${WSO2_OB_APIM_HOME}/dbscripts/apimgt/mysql.sql
sed -i -e 's|INPUTS VARCHAR(1000)|INPUTS VARCHAR(7500)|g' ${WSO2_APIM_HOME}/dbscripts/apimgt/mysql.sql


echo -e "\nCreate database tables"
Expand All @@ -101,8 +101,8 @@ create_databases() {

echo -e "\nUpdate idn_req_object_reference table foreign keys (temporary)"
echo -e "=======================================================================\n"
sed -i -e 's|FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE ,|FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID),|g' ${WSO2_OB_APIM_HOME}/dbscripts/apimgt/mssql.sql
sed -i -e 's|FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID),|FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE,|g' ${WSO2_OB_APIM_HOME}/dbscripts/apimgt/mssql.sql
sed -i -e 's|FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE ,|FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID),|g' ${WSO2_APIM_HOME}/dbscripts/apimgt/mssql.sql
sed -i -e 's|FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID),|FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE,|g' ${WSO2_APIM_HOME}/dbscripts/apimgt/mssql.sql

fi
}
Expand All @@ -123,25 +123,24 @@ create_mysql_databases() {
};

create_mysql_database_tables() {
mysql -u${DB_USER} ${DB_MYSQL_PASS} -D${DB_APIMGT} -h${DB_HOST} -e "SOURCE ${WSO2_OB_APIM_HOME}/dbscripts/apimgt/mysql.sql";
mysql -u${DB_USER} ${DB_MYSQL_PASS} -D${DB_APIMGT} -h${DB_HOST} -e "SOURCE ${WSO2_APIM_HOME}/dbscripts/apimgt/mysql.sql";
echo "Database tables Created for: ${DB_APIMGT}"
mysql -u${DB_USER} ${DB_MYSQL_PASS} -D${DB_AM_CONFIG} -h${DB_HOST} -e "SOURCE ${WSO2_OB_APIM_HOME}/dbscripts/mysql.sql";
mysql -u${DB_USER} ${DB_MYSQL_PASS} -D${DB_AM_CONFIG} -h${DB_HOST} -e "SOURCE ${WSO2_APIM_HOME}/dbscripts/mysql.sql";
echo "Database tables Created for: ${DB_AM_CONFIG}"
mysql -u${DB_USER} ${DB_MYSQL_PASS} -D${DB_GOV} -h${DB_HOST} -e "SOURCE ${WSO2_OB_APIM_HOME}/dbscripts/mysql.sql";
mysql -u${DB_USER} ${DB_MYSQL_PASS} -D${DB_GOV} -h${DB_HOST} -e "SOURCE ${WSO2_APIM_HOME}/dbscripts/mysql.sql";
echo "Database tables Created for: ${DB_GOV}"
mysql -u${DB_USER} ${DB_MYSQL_PASS} -D${DB_USER_STORE} -h${DB_HOST} -e "SOURCE ${WSO2_OB_APIM_HOME}/dbscripts/mysql.sql";
mysql -u${DB_USER} ${DB_MYSQL_PASS} -D${DB_USER_STORE} -h${DB_HOST} -e "SOURCE ${WSO2_APIM_HOME}/dbscripts/mysql.sql";
echo "Database tables Created for: ${DB_USER_STORE}"
};

add_json_fault_sequence() {
sed -i -e 's|</sequence>|\t<sequence key="jsonConverter"/>\n</sequence>|g' ${WSO2_OB_APIM_HOME}/repository/deployment/server/synapse-configs/default/sequences/_cors_request_handler_.xml
sed -i -e 's|</sequence>|\t<sequence key="jsonConverter"/>\n</sequence>|g' ${WSO2_APIM_HOME}/repository/deployment/server/synapse-configs/default/sequences/_cors_request_handler_.xml
}

echo -e "\nReplace hostnames \n"
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}
sed -i -e 's|BI_HOSTNAME|'${BI_HOSTNAME}'|g' ${DEPLOYMENT_TOML_FILE}

echo -e "\nConfigure datasources \n"
echo -e "================================================\n"
Expand All @@ -153,7 +152,7 @@ create_databases;

echo -e "\nCopy deployment.toml file to repository/conf \n"
echo -e "================================================\n"
cp ${DEPLOYMENT_TOML_FILE} ${WSO2_OB_APIM_HOME}/repository/conf/
cp ${DEPLOYMENT_TOML_FILE} ${WSO2_APIM_HOME}/repository/conf/
rm ${DEPLOYMENT_TOML_FILE}
rm -f ${DEPLOYMENT_TOML_FILE}-e

Expand Down
24 changes: 12 additions & 12 deletions financial-services-accelerator/accelerators/fs-apim/bin/merge.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ Function Exit-Clean {

# Get the root directory location of the accelerator. Which is <BASE_PRODUCT>/<ACCELERATOR>/
Set-Location (Join-Path $PSScriptRoot ".\..\")
$WSO2_OB_ACCELERATOR_HOME = (Get-Location).path
Write-Output "[INFO] Accelerator Home : $WSO2_OB_ACCELERATOR_HOME"
$WSO2_FS_ACCELERATOR_HOME = (Get-Location).path
Write-Output "[INFO] Accelerator Home : $WSO2_FS_ACCELERATOR_HOME"

# Get the root directory of the base product.
if ($null -eq $WSO2_BASE_PRODUCT_HOME) {
Set-Location (Join-Path $WSO2_OB_ACCELERATOR_HOME ".\..\")
Set-Location (Join-Path $WSO2_FS_ACCELERATOR_HOME ".\..\")
$WSO2_BASE_PRODUCT_HOME = (Get-Location).path
}
Write-Output "[INFO] Base Product Home : $WSO2_BASE_PRODUCT_HOME"
Expand All @@ -65,17 +65,17 @@ if (-NOT(Test-Path (Join-Path $WSO2_BASE_PRODUCT_HOME "repository\components")))
}

# Remove old open-banking artifacts
Write-Output "[INFO] Removing old open-banking artifacts..."
Get-ChildItem (Join-Path $WSO2_BASE_PRODUCT_HOME "repository\components\dropins") | Where-Object{$_.Name -Match "com.wso2.openbanking.accelerator.*"} | Remove-Item
Get-ChildItem (Join-Path $WSO2_BASE_PRODUCT_HOME "repository\components\lib") | Where-Object{$_.Name -Match "com.wso2.openbanking.accelerator.*"} | Remove-Item
Write-Output "[INFO] All previous OB artifacts have been deleted!"
Write-Output "[INFO] Removing old financial services artifacts..."
Get-ChildItem (Join-Path $WSO2_BASE_PRODUCT_HOME "repository\components\dropins") | Where-Object{$_.Name -Match "org.wso2.financial.services.accelerator.*"} | Remove-Item
Get-ChildItem (Join-Path $WSO2_BASE_PRODUCT_HOME "repository\components\lib") | Where-Object{$_.Name -Match "org.wso2.financial.services.accelerator.*"} | Remove-Item
Write-Output "[INFO] All previous FS artifacts have been deleted!"

# Copying all the new OB artifacts to the base product
# Copy-Item -Force -Recurse -Verbose (Join-Path $WSO2_OB_ACCELERATOR_HOME "carbon-home\*") -Destination $WSO2_BASE_PRODUCT_HOME
# Copying all the new FS artifacts to the base product
# Copy-Item -Force -Recurse -Verbose (Join-Path $WSO2_FS_ACCELERATOR_HOME "carbon-home\*") -Destination $WSO2_BASE_PRODUCT_HOME
# Using Robocopy.exe becuase powershell Copy-Item cmdlet doesn't do recursive copying after a certain number of subdirectories.
Write-Output "[INFO] Copying new open-banking artifacts..."
Robocopy.exe (Join-Path $WSO2_OB_ACCELERATOR_HOME "carbon-home") $WSO2_BASE_PRODUCT_HOME * /E /NFL /NDL /NJH /NJS /nc /ns /np
Write-Output "[INFO] All the new OB artifacts has been copied!"
Write-Output "[INFO] Copying new financial services artifacts..."
Robocopy.exe (Join-Path $WSO2_FS_ACCELERATOR_HOME "carbon-home") $WSO2_BASE_PRODUCT_HOME * /E /NFL /NDL /NJH /NJS /nc /ns /np
Write-Output "[INFO] All the new FS artifacts has been copied!"

Write-Output "[INFO] Completed!"

Expand Down
16 changes: 8 additions & 8 deletions financial-services-accelerator/accelerators/fs-apim/bin/merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
# specific language governing permissions and limitations
# under the License.

# merge.sh script copy the WSO2 OB APIM accelerator artifacts on top of WSO2 APIM base product
# merge.sh script copy the WSO2 FS APIM accelerator artifacts on top of WSO2 APIM base product
#
# merge.sh <WSO2_OB_APIM_HOME>
# merge.sh <WSO2_APIM_HOME>

WSO2_OB_APIM_HOME=$1
WSO2_APIM_HOME=$1

# set accelerator home
cd ../
ACCELERATOR_HOME=$(pwd)
echo "Accelerator home is: ${ACCELERATOR_HOME}"

# set product home
if [ "${WSO2_OB_APIM_HOME}" == "" ];
if [ "${WSO2_APIM_HOME}" == "" ];
then
cd ../
WSO2_OB_APIM_HOME=$(pwd)
echo "Product home is: ${WSO2_OB_APIM_HOME}"
WSO2_APIM_HOME=$(pwd)
echo "Product home is: ${WSO2_APIM_HOME}"
fi

# validate product home
if [ ! -d "${WSO2_OB_APIM_HOME}/repository/components" ]; then
if [ ! -d "${WSO2_APIM_HOME}/repository/components" ]; then
echo -e "\n\aERROR:specified product path is not a valid carbon product path\n";
exit 2;
else
Expand All @@ -44,5 +44,5 @@ fi

echo -e "\nCopying open banking artifacts\n"
echo -e "================================================\n"
cp -r ${ACCELERATOR_HOME}/carbon-home/* "${WSO2_OB_APIM_HOME}"/
cp -r ${ACCELERATOR_HOME}/carbon-home/* "${WSO2_APIM_HOME}"/
echo -e "\nComplete!\n"
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
-->

<Server xmlns="http://wso2.org/projects/carbon/financial-services.xml">
<Common>
<Cache>
<CacheAccessExpiry>60</CacheAccessExpiry>
<CacheModifiedExpiry>60</CacheModifiedExpiry>
</Cache>
</Common>
<Gateway>
<RequestRouter>com.wso2.openbanking.accelerator.gateway.executor.core.DefaultRequestRouter</RequestRouter>
<!-- Custom Throttle Data publisher -->
<CustomThrottleDataPublisher>com.wso2.openbanking.sample.throttling.publisher.SampleThrottlingDataPublisher</CustomThrottleDataPublisher>
<OpenBankingGatewayExecutors>
<RequestRouter>org.wso2.financial.services.accelerator.gateway.executor.core.DefaultRequestRouter</RequestRouter>
<FinancialServicesGatewayExecutors>

</OpenBankingGatewayExecutors>
<ConsentValidationEndpoint>https://localhost:9446/api/openbanking/consent/validate</ConsentValidationEndpoint>
</FinancialServicesGatewayExecutors>
<ConsentValidationEndpoint>https://localhost:9446/api/fs/consent/validate</ConsentValidationEndpoint>
<Cache>
<GatewayCache>
<CacheAccessExpiry>60</CacheAccessExpiry>
Expand All @@ -34,66 +38,6 @@
</Cache>
</Gateway>
<PublisherURL>https://localhost:9443</PublisherURL>
<APIMAnalytics>
<Enabled>false</Enabled>
</APIMAnalytics>
<DataPublishing>
<Enabled>true</Enabled>
<Username>admin</Username>
<Password>admin</Password>
<ServerURL>{tcp://localhost:7612}</ServerURL>
<AuthURL></AuthURL>
<!-- Allowed values: Thrift -->
<Protocol>Thrift</Protocol>
<PoolSize>10</PoolSize>
<QueueSize>32768</QueueSize>
<WorkerThreadCount>10</WorkerThreadCount>
<PoolWaitTimeMs>60000</PoolWaitTimeMs>
<Thrift>
<PublishingTimeout>2000</PublishingTimeout>
<Streams>
<APIInputStream>
<Attribute name="consentId" priority="1"/>
<Attribute name="consumerId" priority="2"/>
<Attribute name="clientId" priority="3"/>
<Attribute name="userAgent" priority="4"/>
<Attribute name="statusCode" priority="5"/>
<Attribute name="httpMethod" priority="6"/>
<Attribute name="responsePayloadSize" priority="7"/>
<Attribute name="electedResource" priority="8"/>
<Attribute name="apiName" priority="9"/>
<Attribute name="apiSpecVersion" priority="10"/>
<Attribute name="timestamp" priority="11"/>
<Attribute name="messageId" priority="12"/>
</APIInputStream>
<AuthenticationInputStream>
<Attribute name="userId" priority="1"/>
<Attribute name="authenticationStep" priority="2"/>
<Attribute name="authenticationStatus" priority="3"/>
<Attribute name="authenticationApproach" priority="4"/>
<Attribute name="psuChannel" priority="5"/>
<Attribute name="timestamp" priority="6"/>
</AuthenticationInputStream>
</Streams>
</Thrift>
</DataPublishing>
<DCR>
<APIMRESTEndPoints>
<AppCreation>api/am/devportal/v2/applications</AppCreation>
<KeyGeneration>api/am/devportal/v2/applications/application-id/map-keys</KeyGeneration>
<RetrieveAPIS>api/am/devportal/v2/apis</RetrieveAPIS>
<SubscribeAPIs>api/am/devportal/v2/subscriptions/multiple</SubscribeAPIs>
</APIMRESTEndPoints>
<TokenEndpoint>https://localhost:9446/oauth2/token</TokenEndpoint>
<RegulatoryAPINames>
<API></API>
</RegulatoryAPINames>
<JWKSEndpointName>jwks_uri</JWKSEndpointName>
<JWKS-Retriever>
<ConnectionTimeout>0</ConnectionTimeout>
<ReadTimeout>0</ReadTimeout>
</JWKS-Retriever>
</DCR>
<HTTPConnectionPool>
<MaxConnections>2000</MaxConnections>
<MaxConnectionsPerRoute>1500</MaxConnectionsPerRoute>
Expand Down
Loading

0 comments on commit e1c7fe0

Please sign in to comment.