...
Download following dependency jar files and put them into
[JMETER_HOME]/lib/ext
directory.
Step 1 is mandatory. Otherwise, the JMeter scripts will notNote This step is mandatory for the JMeter scripts to load.
Generate public and private keys using the following commands.
Code Block keytool -genkey -alias <myalias> -keyalg RSA -keystore <keystore-name>.jks keytool -export -alias <myalias> -file <filename> -keystore <keystore-name>.jks keytool -importkeystore -srckeystore <keystore-name>.jks -destkeystore myapp.p12 -deststoretype PKCS12 openssl pkcs12 -in myapp.p12 -nokeys -out myalias.pem openssl pkcs12 -in myapp.p12 -nodes -nocerts -out <private-key-name>.pem
Tip If you have obtained the OBIE certificate when configuring DCR, use the certificate and keys to generate the keystore with the following commands.
Find the below descriptions for the parameters. Change them accordingly;
tpp.com.crt :
Private certificate obtained from OBIEtpp.com.key :
Private keysCode Block openssl pkcs12 -export -name tim -in tpp.com.crt -inkey tpp.com.key -out tim.p12 keytool -importkeystore -destkeystore keystore.jks -srckeystore tim.p12 -srcstoretype pkcs12 -alias tim
Create a sample application, subscribe to an API and generate production/sandbox keys. Open and provide the content between BEGIN CERTIFICATE and END CERTIFICATE of the
myalias.pem
file as the application certificate.Create a directory named
jwtExtResources
in a preferred location and place thejks keystore
file created in the above steps.Create a
setup.properties
file in[JMETER_HOME]/bin
path and add the required properties. Example properties are as follows.Code Block language bash ip_address=<Enter your ip address here. Ex: 127.0.0.1> port=<Enter the specific http port here. Ex: 8280> https_port=<Enter the specific https port here.Ex: 8243> client_id=<Enter your client_id here. Ex: C5jcraWOnrqzBdvm2x0g6h8hcJAa> domain=<Enter your domain address here. Ex: openbanking.staging.wso2.com> result=<Enter the path to save the results here. Ex: /home/user/jmeter/apache-jmeter-3.2/bin/writedisabled/results> jwtExtResources=<Enter the path to jwtExtResources directory here. Ex: /home/user/jmeter/apache-jmeter-3.2/bin/jwtExtResources> redirecturl=<where the authorization flow is redirected to when creating the application> algorithm=<Enter the algorith as a new property> PS256
Update the global variable to read the
setup.properties
file by calling the variable in the format. e.g.,${__P(ip_address)}.
Within the global variable, set the values for the below properties based on published API's. This will ensure that each API call reads the API context, version and resource, path based on the configurations.
api_context
version
api_resource
Create a file named
jwtbuilder.properties
in[JMETER_HOME]/bin/jwtExtResources
directory with below details.Code Block language bash keyStorePassword=<Enter your key store password here. Ex.wso2carbon> keyStoreDomainName=<Enter alias name of the keystore here. Ex.myalias> clientID=<Enter application client ID here. Ex. nwU59qy9AsDqftmwLcfmkvOhvuYa> keyStoreName=<Enter KeyStore file name here. Ex.TodayApp.jks> tokenAPIURL=<Enter token endpoint URL which you have to use as aud value Ex. http://localhost:8280/token> Algorithm=<Enter algorithm details which JWT token need to be generated Ex. PS256>
...