-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2715 from sf2ne/sfaruk/tokenval
Node and Agbot Tokens Updated to match new password constraints
- Loading branch information
Showing
7 changed files
with
24 additions
and
24 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
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ function set_exports { | |
export DEVICE_ID="an12345" | ||
export DEVICE_NAME="anaxdev1" | ||
export DEVICE_ORG="[email protected]" | ||
export TOKEN="abcdefg" | ||
export TOKEN="Abcdefghijklmno1" | ||
|
||
export HZN_AGENT_PORT=8510 | ||
export ANAX_API="http://localhost:${HZN_AGENT_PORT}" | ||
|
@@ -170,7 +170,7 @@ then | |
export HZN_AGENT_PORT=8510 | ||
export ANAX_API="http://localhost:${HZN_AGENT_PORT}" | ||
export EXCH="${EXCH_APP_HOST}" | ||
export TOKEN="abcdefg" | ||
export TOKEN="Abcdefghijklmno1" | ||
|
||
if [ ${CERT_LOC} -eq "1" ]; then | ||
export HZN_MGMT_HUB_CERT_PATH="/certs/css.crt" | ||
|
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 |
---|---|---|
|
@@ -194,7 +194,7 @@ fi | |
|
||
## test registering node with both flags and positional arguments, conflict | ||
echo -e "${PREFIX} Testing 'hzn register' with conflicting inputs" | ||
cmd="hzn register -u $USERDEV_ADMIN_AUTH -n an12345:abcdefghijk -o userdev -f /tmp/reg_userinput.json --policy /tmp/node_policy.json [email protected] sns" | ||
cmd="hzn register -u $USERDEV_ADMIN_AUTH -n an12345:Abcdefghijklmno1 -o userdev -f /tmp/reg_userinput.json --policy /tmp/node_policy.json [email protected] sns" | ||
echo -e "$cmd" | ||
ret=`$cmd 2>&1` | ||
if [ $? -eq 0 ]; then | ||
|
@@ -208,13 +208,13 @@ fi | |
|
||
## test registering policy based node, update token | ||
echo -e "${PREFIX} Testing 'hzn register' with policy." | ||
cmd="hzn register -u $USERDEV_ADMIN_AUTH -n an12345:abcdefghijk -o userdev -f /tmp/reg_userinput.json --policy /tmp/node_policy.json" | ||
cmd="hzn register -u $USERDEV_ADMIN_AUTH -n an12345:Abcdefghijklmno1 -o userdev -f /tmp/reg_userinput.json --policy /tmp/node_policy.json" | ||
reg_node "$cmd" | ||
verify_agreements "userdev" "userdevadmin:userdevadminpw" | ||
|
||
## test register while the node is registered | ||
echo -e "${PREFIX} Testing 'hzn register' while the node is registered." | ||
ret=$(hzn register -u $USERDEV_ADMIN_AUTH -n an12345:abcdefg -o userdev -f /tmp/reg_userinput.json --policy /tmp/node_policy.json 2>&1) | ||
ret=$(hzn register -u $USERDEV_ADMIN_AUTH -n an12345:Abcdefghijklmno1 -o userdev -f /tmp/reg_userinput.json --policy /tmp/node_policy.json 2>&1) | ||
if [ $? -eq 0 ]; then | ||
echo -e "${PREFIX} 'hzn register' should have failed because the node is registered already." | ||
exit 1 | ||
|
@@ -231,21 +231,21 @@ unreg_node | |
hzn exchange -u e2edevadmin:e2edevadminpw -o [email protected] node remove an12345 -f | ||
|
||
echo -e "${PREFIX} Testing 'hzn register' with pattern sns." | ||
cmd="hzn register -u e2edevadmin:e2edevadminpw -n an12345:abcdefg -f /tmp/reg_userinput.json -o [email protected] -p [email protected]/sns" | ||
cmd="hzn register -u e2edevadmin:e2edevadminpw -n an12345:Abcdefghijklmno1 -f /tmp/reg_userinput.json -o [email protected] -p [email protected]/sns" | ||
reg_node "$cmd" | ||
verify_agreements "[email protected]" "e2edevadmin:e2edevadminpw" | ||
|
||
## register pattern sns using positional argument, node already exists | ||
unreg_node | ||
echo -e "${PREFIX} Testing 'hzn register' with pattern sns using positional argument." | ||
cmd="hzn register -n [email protected]/an12345:abcdefg -f /tmp/reg_userinput.json [email protected] sns" | ||
cmd="hzn register -n [email protected]/an12345:Abcdefghijklmno1 -f /tmp/reg_userinput.json [email protected] sns" | ||
reg_node "$cmd" | ||
verify_agreements "[email protected]" "e2edevadmin:e2edevadminpw" | ||
|
||
## test registering node with both sns pattern and policy | ||
unreg_node | ||
echo -e "${PREFIX} Testing 'hzn register' with both pattern sns and policy." | ||
cmd="hzn register -n an12345:abcdefg -o [email protected] -f /tmp/reg_userinput.json -p sns --policy /tmp/node_policy.json" | ||
cmd="hzn register -n an12345:Abcdefghijklmno1 -o [email protected] -f /tmp/reg_userinput.json -p sns --policy /tmp/node_policy.json" | ||
reg_node "$cmd" | ||
|
||
# make sure node has pattern associated. | ||
|
@@ -261,7 +261,7 @@ verify_agreements "[email protected]" "e2edevadmin:e2edevadminpw" | |
unreg_node | ||
export [email protected] | ||
echo -e "${PREFIX} Testing 'hzn register' with pattern sall with HZN_ORG_ID" | ||
cmd="hzn register -n an12345:abcdefg -f /tmp/reg_userinput_all.json -p sall" | ||
cmd="hzn register -n an12345:Abcdefghijklmno1 -f /tmp/reg_userinput_all.json -p sall" | ||
reg_node "$cmd" | ||
|
||
ORG_ID="[email protected]" ADMIN_AUTH="e2edevadmin:e2edevadminpw" ./verify_agreements.sh | ||
|
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 |
---|---|---|
|
@@ -143,7 +143,7 @@ echo "$CR8IBM" | |
|
||
# Register agreement bot user in the exchange | ||
echo "Creating Agbot user..." | ||
CR8AGBOT=$(curl -sLX POST $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "root/root:${EXCH_ROOTPW}" -d '{"password":"agbot1pw","email":"me%40gmail.com","admin":false}' "${EXCH_URL}/orgs/IBM/users/agbot1" | jq -r '.msg') | ||
CR8AGBOT=$(curl -sLX POST $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "root/root:${EXCH_ROOTPW}" -d '{"password":"Abcdefghijklmno1","email":"me%40gmail.com","admin":false}' "${EXCH_URL}/orgs/IBM/users/agbot1" | jq -r '.msg') | ||
echo "$CR8AGBOT" | ||
|
||
# Register users in the exchange | ||
|
@@ -156,37 +156,37 @@ CR8UANAX=$(curl -sLX POST $CERT_VAR --header 'Content-Type: application/json' -- | |
echo "$CR8UANAX" | ||
|
||
echo "Registering Anax device1..." | ||
REGANAX1=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "[email protected]/anax1:anax1pw" -d '{"token":"abcdefg","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/[email protected]/nodes/an12345" | jq -r '.msg') | ||
REGANAX1=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "[email protected]/anax1:anax1pw" -d '{"token":"Abcdefghijklmno1","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/[email protected]/nodes/an12345" | jq -r '.msg') | ||
echo "$REGANAX1" | ||
|
||
echo "Registering Anax device2..." | ||
REGANAX2=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "[email protected]/anax1:anax1pw" -d '{"token":"abcdefg","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/[email protected]/nodes/an54321" | jq -r '.msg') | ||
REGANAX2=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "[email protected]/anax1:anax1pw" -d '{"token":"Abcdefghijklmno1","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/[email protected]/nodes/an54321" | jq -r '.msg') | ||
echo "$REGANAX2" | ||
|
||
# register an anax devices for userdev in order to test the case where the pattern is from a different org than the device org. | ||
echo "Registering Anax device1 in userdev org..." | ||
REGUANAX1=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "userdev/useranax1:useranax1pw" -d '{"token":"abcdefg","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/userdev/nodes/an12345" | jq -r '.msg') | ||
REGUANAX1=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "userdev/useranax1:useranax1pw" -d '{"token":"Abcdefghijklmno1","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/userdev/nodes/an12345" | jq -r '.msg') | ||
echo "$REGUANAX1" | ||
|
||
echo "Registering Anax device2 in userdev org..." | ||
REGUANAX2=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "userdev/useranax1:useranax1pw" -d '{"token":"abcdefg","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/userdev/nodes/an54321" | jq -r '.msg') | ||
REGUANAX2=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "userdev/useranax1:useranax1pw" -d '{"token":"Abcdefghijklmno1","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/userdev/nodes/an54321" | jq -r '.msg') | ||
echo "$REGUANAX2" | ||
|
||
echo "Registering Anax device1 in customer org..." | ||
REGANAX1C=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "Customer1/icpadmin:icpadminpw" -d '{"token":"abcdefg","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/Customer1/nodes/an12345" | jq -r '.msg') | ||
REGANAX1C=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "Customer1/icpadmin:icpadminpw" -d '{"token":"Abcdefghijklmno1","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/Customer1/nodes/an12345" | jq -r '.msg') | ||
echo "$REGANAX1C" | ||
|
||
DEVICE_NUM=6 | ||
NUM_AGENTS=$((${MULTIAGENTS}+$DEVICE_NUM)) | ||
while [ ${DEVICE_NUM} -lt ${NUM_AGENTS} ]; do | ||
echo "Registering Anax device${DEVICE_NUM}..." | ||
REGANAXMUL=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "[email protected]/anax1:anax1pw" -d '{"token":"abcdefg","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/[email protected]/nodes/anaxdevice${DEVICE_NUM}" | jq -r '.msg') | ||
REGANAXMUL=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "[email protected]/anax1:anax1pw" -d '{"token":"Abcdefghijklmno1","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/[email protected]/nodes/anaxdevice${DEVICE_NUM}" | jq -r '.msg') | ||
echo "$REGANAXMUL" | ||
echo "Registering Anax device${DEVICE_NUM} in userdev org..." | ||
REGUANAXMULU=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "userdev/useranax1:useranax1pw" -d '{"token":"abcdefg","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/userdev/nodes/anaxdevice${DEVICE_NUM}" | jq -r '.msg') | ||
REGUANAXMULU=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "userdev/useranax1:useranax1pw" -d '{"token":"Abcdefghijklmno1","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/userdev/nodes/anaxdevice${DEVICE_NUM}" | jq -r '.msg') | ||
echo "$REGUANAXMULU" | ||
echo "Registering Anax device${DEVICE_NUM} in customer org..." | ||
REGANAXMULC=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "Customer1/icpadmin:icpadminpw" -d '{"token":"abcdefg","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/Customer1/nodes/anaxdevice${DEVICE_NUM}" | jq -r '.msg') | ||
REGANAXMULC=$(curl -sLX PUT $CERT_VAR --header 'Content-Type: application/json' --header 'Accept: application/json' -u "Customer1/icpadmin:icpadminpw" -d '{"token":"Abcdefghijklmno1","name":"anaxdev","registeredServices":[],"msgEndPoint":"","softwareVersions":{},"publicKey":"","pattern":"","arch":"${ARCH}"}' "${EXCH_URL}/orgs/Customer1/nodes/anaxdevice${DEVICE_NUM}" | jq -r '.msg') | ||
echo "$REGANAXMULC" | ||
let DEVICE_NUM=DEVICE_NUM+1 | ||
done | ||
|
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 |
---|---|---|
|
@@ -97,7 +97,7 @@ then | |
fi | ||
|
||
# Test what happens when a valid node tries to access an API | ||
KNODE=$(curl -sLX GET -w "%{http_code}" $CERT_VAR -u userdev/susehello/an12345:abcdefg "${CSS_URL}/api/v1/destinations/userdev") | ||
KNODE=$(curl -sLX GET -w "%{http_code}" $CERT_VAR -u userdev/susehello/an12345:Abcdefghijklmno1 "${CSS_URL}/api/v1/destinations/userdev") | ||
|
||
if [ "$KNODE" != "Unauthorized403" ] | ||
then | ||
|
@@ -1019,7 +1019,7 @@ verifyUserAccessForPublicObject $USER_ORG $USER_REG_USERNAME $USER_REG_USERPWD $ | |
|
||
# node [email protected]/an12345 has READ and WRITE access to all object types in [email protected] org | ||
NODE_ID="an12345" | ||
NODE_TOKEN="abcdefg" | ||
NODE_TOKEN="Abcdefghijklmno1" | ||
TARGET_NUM_OBJS=0 | ||
testUserNotHaveAccessToPrivateObjects $USER_ORG $NODE_ID $NODE_TOKEN $TARGET_NUM_OBJS "test" "test_user_access" | ||
verifyUserAccessForPublicObject $USER_ORG $NODE_ID $NODE_TOKEN $PUBLIC_OBJ_ORG $PUBLIC_OBJ_TYPE $PUBLIC_OBJ_ID | ||
|