Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make JWT Token Issuer Claim Configurable #50

Open
wants to merge 1 commit into
base: Long-running-test
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions long-running-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@ The [netty-service](netty-service) directory has the netty service artifacts whi

1. Run the `TestData_Add_Super_Tenant_Users.jmx` script to create users in the super tenant domain. The script has been configured to create 50 users.

```
Example Usage:
./jmeter.sh -n -t TestData_Add_Super_Tenant_Users.jmx -l user-creation.jtl
```

This script has been configured to run with the following default values.

- host=localhost
- port=9443

It is possible to override these by passing the values as command line arguments.

```
Example Usage:
./jmeter.sh -n -t TestData_Add_Super_Tenant_Users.jmx -l user-creation.jtl -Jhost=api.am.wso2.com -Jport=9443
```

2. Run the `setup.sh` to setup the environment to run the long running tests. The following will occur when the `setup.sh` is executed.

- Create applications and generate keys in the Developer Portal. The consumer key, consumer secret of each application will be written to `target/client_credentials.csv` file. The application names will have "app" as the prefix followed by a number such as app1, app2, app3. The script has been configured to create 5 applications.
Expand Down
1 change: 0 additions & 1 deletion long-running-tests/setup/create-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ get_keymanager=$($curl_command -H "Authorization: Bearer $app_access_token" "${b
# To add subscriber to AM_SUBSCRIBER table. Else, application addition will give an error.
application_id=$($curl_command -H "Authorization: Bearer $subscribe_access_token" "${base_https_url}/api/am/devportal/v2/applications?query=app1" | jq -r '.list[0] | .applicationId')

mkdir -p "$script_dir/target"
## Creating an empty csv file to store the consumer key and consumer secrets of the applications
echo -n "" > "$script_dir/target/client_credentials.csv"

Expand Down
12 changes: 8 additions & 4 deletions long-running-tests/setup/generate-jwt-tokens.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# ----------------------------------------------------------------------------

script_dir=$(dirname "$0")
apim_host=""
tokens_count=""
consumer_key=""
tokens_file=""
Expand All @@ -27,15 +28,19 @@ client_keys_file=""
function usage() {
echo ""
echo "Usage: "
echo "$0 -t <tokens_count>"
echo "$0 -a <apim_host> -t <tokens_count>"
echo ""
echo "-a: Hostname of WSO2 API Manager."
echo "-t: Count of the tokens."
echo "-h: Display this help and exit."
echo ""
}

while getopts "t:h" opt; do
while getopts "a:t:h" opt; do
case "${opt}" in
a)
apim_host=${OPTARG}
;;
t)
tokens_count=${OPTARG}
;;
Expand All @@ -56,7 +61,6 @@ if [[ -z $tokens_count ]]; then
exit 1
fi

mkdir -p "$script_dir/target"
jwt_tokens_file="$script_dir/target/jwt_tokens.csv"
echo -n "" > $jwt_tokens_file

Expand All @@ -72,7 +76,7 @@ do
tokens_file="$script_dir/target/jwt_tokens_$consumer_key.csv"
generate_tokens_command="java -Xms128m -Xmx128m -jar $script_dir/token-generation-artifacts/jwt-generator-0.1.1-SNAPSHOT.jar \
--key-store-file $script_dir/token-generation-artifacts/wso2carbon.jks --consumer-key $consumer_key\
--tokens-count $tokens_count --output-file $tokens_file"
--tokens-count $tokens_count --output-file $tokens_file --apim-host $apim_host"
echo "Generating Tokens: $generate_tokens_command"
$generate_tokens_command
cat $tokens_file >> $jwt_tokens_file
Expand Down
4 changes: 3 additions & 1 deletion long-running-tests/setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ while getopts "a:b:v:h" opt; do
done
shift "$((OPTIND - 1))"

mkdir -p "$script_dir/target"

## Create Applications
$script_dir/create-apps.sh -a $apim_host -n 5 -k JWT

Expand All @@ -72,4 +74,4 @@ $script_dir/create-api.sh -a $apim_host -i 1 -n mediationSample -d mediationDesc
-b $backend_endpoint_url -v $vhost -o mediation-api-sequence.xml

## Generate JWT Tokens
$script_dir/generate-jwt-tokens.sh -t 1000
$script_dir/generate-jwt-tokens.sh -a $apim_host -t 1000
Binary file not shown.