-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@echo off | ||
|
||
REM Create 'certs' directory (if not exists) | ||
mkdir certs | ||
cd certs || exit /b | ||
|
||
REM Download the example_client_tls.pem and example_client_signing.pem files | ||
curl -O https://raw.githubusercontent.com/ing-bank/ing-open-banking-cli/master/apps/sandbox/certificates/example_client_tls.pem | ||
curl -O https://raw.githubusercontent.com/ing-bank/ing-open-banking-cli/master/apps/sandbox/certificates/example_client_signing.pem | ||
curl -O https://raw.githubusercontent.com/ing-bank/ing-open-banking-cli/master/apps/sandbox/certificates/example_client_tls.key | ||
curl -O https://raw.githubusercontent.com/ing-bank/ing-open-banking-cli/master/apps/sandbox/certificates/example_client_signing.key | ||
|
||
REM Create the 'psd2' directory (if not exists) | ||
mkdir psd2 | ||
cd psd2 || exit /b | ||
|
||
REM Download the PSD2 example_client_tls.pem and example_client_signing.pem files | ||
curl -O https://raw.githubusercontent.com/ing-bank/ing-open-banking-cli/master/apps/sandbox/certificates/psd2/example_client_tls.pem | ||
curl -O https://raw.githubusercontent.com/ing-bank/ing-open-banking-cli/master/apps/sandbox/certificates/psd2/example_client_signing.pem | ||
curl -O https://raw.githubusercontent.com/ing-bank/ing-open-banking-cli/master/apps/sandbox/certificates/psd2/example_client_tls.key | ||
curl -O https://raw.githubusercontent.com/ing-bank/ing-open-banking-cli/master/apps/sandbox/certificates/psd2/example_client_signing.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@echo off | ||
setlocal | ||
|
||
REM Check if the required arguments are provided | ||
if "%1"=="" ( | ||
echo Usage: %0 SRC_DIR TLS SIGN DESTINATION FILENAME | ||
echo Example: %0 certs\ example_client_tls example_client_signing java\open-banking-demo-app\src\main\resources\ keystore-premium.jks | ||
exit /b 1 | ||
) | ||
|
||
REM Variables passed as arguments | ||
set SRC_DIR=%1 | ||
set TLS=%2 | ||
set SIGN=%3 | ||
set DESTINATION=%4 | ||
set FILENAME=%5 | ||
|
||
set TEMP_KEYSTORE_NAME=store-open.keys | ||
|
||
REM Check if destination directory exists | ||
if not exist "%DESTINATION%" ( | ||
echo. | ||
echo Directory %DESTINATION% DOES NOT exist. | ||
echo. | ||
exit /b | ||
) | ||
|
||
REM Prompt for password | ||
echo. | ||
echo Please provide a password of at least 6 characters. | ||
echo This password should be used in your application to retrieve your certificates and keys. | ||
echo. | ||
set /p PASSWORD=Enter password: | ||
|
||
REM Suppress password input by using the choice command in Windows (or PowerShell for more control if needed) | ||
REM Create tls.p12 and sign.p12 with OpenSSL | ||
openssl pkcs12 -export -in "%SRC_DIR%%TLS%.pem" -inkey "%SRC_DIR%%TLS%.key" -name tls -password pass:%PASSWORD% -out tls.p12 | ||
openssl pkcs12 -export -in "%SRC_DIR%%SIGN%.pem" -inkey "%SRC_DIR%%SIGN%.key" -name sign -password pass:%PASSWORD% -out sign.p12 | ||
|
||
REM Import into keystore with keytool | ||
keytool -importkeystore -srckeystore tls.p12 -destkeystore "%TEMP_KEYSTORE_NAME%" -srcstoretype pkcs12 -alias tls -srcstorepass %PASSWORD% -deststorepass %PASSWORD% | ||
keytool -importkeystore -srckeystore sign.p12 -destkeystore "%TEMP_KEYSTORE_NAME%" -srcstoretype pkcs12 -alias sign -srcstorepass %PASSWORD% -deststorepass %PASSWORD% | ||
|
||
REM Copy the keystore file to the destination with the specified filename | ||
copy "%TEMP_KEYSTORE_NAME%" "%DESTINATION%%FILENAME%" | ||
|
||
REM Clean up temporary files | ||
del "%TEMP_KEYSTORE_NAME%" | ||
del tls.p12 | ||
del sign.p12 | ||
|
||
endlocal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@echo off | ||
setlocal | ||
|
||
REM Set variables | ||
set SRC_DIR=certs/ | ||
set TLS=example_client_tls | ||
set SIGN=example_client_signing | ||
set DESTINATION=java\open-banking-demo-app\src\main\resources\ | ||
set FILENAME=keystore-premium.jks | ||
set SIMPLE_DESTINATION=java\open-banking-simple-app\src\main\resources\ | ||
|
||
REM Run the key generation script with parameters | ||
call keygen-generic.cmd %SRC_DIR% %TLS% %SIGN% %DESTINATION% %FILENAME% | ||
|
||
REM Copy the generated keystore file to the simple app destination | ||
copy "%DESTINATION%%FILENAME%" "%SIMPLE_DESTINATION%%FILENAME%" | ||
|
||
endlocal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@echo off | ||
setlocal | ||
|
||
REM Set variables | ||
set SRC_DIR=certs\psd2\ | ||
set TLS=example_client_tls | ||
set SIGN=example_client_signing | ||
set DESTINATION=java\open-banking-demo-app\src\main\resources\ | ||
set FILENAME=keystore-psd2.jks | ||
set SIMPLE_DESTINATION=java\open-banking-simple-app\src\main\resources\ | ||
|
||
REM Run the key generation script with parameters | ||
call keygen-generic.cmd %SRC_DIR% %TLS% %SIGN% %DESTINATION% %FILENAME% | ||
|
||
REM Copy the generated keystore file to the simple app destination | ||
copy "%DESTINATION%%FILENAME%" "%SIMPLE_DESTINATION%%FILENAME%" | ||
|
||
endlocal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@echo off | ||
|
||
set BASE_URL=https://api.sandbox.ing.com | ||
|
||
REM Find the JAR file in the target directory | ||
for %%f in (java\open-banking-demo-app\target\open-banking-demo-app-*.jar) do ( | ||
set JAR_FILE=%%f | ||
) | ||
if not defined JAR_FILE ( | ||
echo Error: No JAR file found matching pattern java\open-banking-demo-app\target\open-banking-demo-app-*.jar | ||
exit /b 1 | ||
) | ||
|
||
REM Run the Java application | ||
java -jar "%JAR_FILE%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@echo off | ||
|
||
REM Run the getLatestSwaggerVersion script with different parameters | ||
call getLatestSwaggerVersion.cmd 2d00fd5f-88cd-4416-bbca-f309ebb03bfe oauth2 | ||
call getLatestSwaggerVersion.cmd b6d5093d-626e-41e9-b9e8-ff287bbe2c07 account/information | ||
call getLatestSwaggerVersion.cmd 6aa25087-d05d-428e-b7c6-d9131cb46498 payment/initiation | ||
call getLatestSwaggerVersion.cmd 01199464-4247-4770-8ab8-c3371052e9e5 payment/request | ||
call getLatestSwaggerVersion.cmd 5f5106c4-3413-4b3c-890a-bb4cfa165dba showcase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
@echo off | ||
setlocal | ||
|
||
REM Set variables from arguments | ||
set API_ID=%1 | ||
set SWAGGER_DIR=%2 | ||
|
||
echo apiId: %API_ID% | ||
echo swaggerDir: %SWAGGER_DIR% | ||
set prefix=)]}', | ||
|
||
REM Function to decode base64 and apply jq filter | ||
set "_jq=" | ||
for /f "tokens=*" %%A in ('powershell -Command "[Convert]::FromBase64String((Get-Content -Raw) -replace '\n', '') | % { $_ | ForEach-Object { [System.Text.Encoding]::UTF8.GetString($_) } }"' ) do set "_jq=%%A" | ||
REM Fetch versions | ||
for /f "tokens=*" %%A in ('curl "https://api.developer.ing.com/apis/%API_ID%/versions"') do set "raw_versions=%%A" | ||
|
||
REM Remove prefix from raw_versions | ||
set "cleaned_versions=%raw_versions:%prefix%=%" | ||
|
||
echo %cleaned_versions% | ||
|
||
REM Parse versions | ||
for /f %%A in ('echo %cleaned_versions% ^| jq -r ".apis[] | @base64"') do ( | ||
set "row=%%A" | ||
for /f %%B in ('echo %row% ^| base64 --decode ^| jq -r ".api.name"') do set "name=%%B" | ||
for /f %%C in ('echo %row% ^| base64 --decode ^| jq -r ".versionNumber"') do set "versionNumber=%%C" | ||
for /f %%D in ('echo %row% ^| base64 --decode ^| jq -r ".versionId"') do set "versionId=%%D" | ||
for /f %%E in ('echo %row% ^| base64 --decode ^| jq -r ".status"') do set "status=%%E" | ||
|
||
echo -------------- | ||
echo Name: %name% | ||
echo Version Number: %versionNumber% | ||
echo Version ID: %versionId% | ||
echo Status: %status% | ||
|
||
if "%status%"=="LIVE" ( | ||
set "file_name=..\api\%SWAGGER_DIR%\%name%.json" | ||
set "file_name=%file_name: =-%" | ||
|
||
if not exist "%file_name%" ( | ||
echo %file_name% does not exist. Downloading... | ||
curl "https://api.touchpoint.ing.net/apis/%API_ID%/versions/%versionId%/specification/download?format=json&pretty=true" -o "%file_name%" | ||
git add "%file_name%" | ||
) else ( | ||
echo %file_name% exists. | ||
for /f "tokens=*" %%F in ('jq -r ".info.version" "%file_name%"') do set "currentVersion=%%F" | ||
echo Current version: %currentVersion% | ||
if "%versionNumber%"=="%currentVersion%" ( | ||
echo VERSION MATCH | ||
) else ( | ||
echo DOWNLOAD NEW VERSION | ||
curl "https://api.touchpoint.ing.net/apis/%API_ID%/versions/%versionId%/specification/download?format=json&pretty=true" -o "%file_name%" | ||
git add "%file_name%" | ||
) | ||
) | ||
goto :break | ||
) | ||
echo -------------- | ||
) | ||
|
||
:break | ||
endlocal |