Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #Note - If you want to go through wcmesb[dev|test|qa], you will have to have your IP committed into the webuser-service.yml file in
- # the aem-services-config repository. This is becuase the netscaler there is configured to set the "client-ip" header
- # to your environment. Otherwise, go straight to the service and pretend your IP is "216.17.41.254" (which is what Hallmark plans to use).
- #myIp="216.17.41.254"
- #myIp="98.178.166.155" #my real ip at the time I was testing this
- #host="http://wcmesbtest.pennwell.com"
- host="http://testaemservices01.pennwell.net:8126"
- #wcmesb only
- if [ -z $myIp ]; then
- #Rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should properly authenticate.
- echo "-----Doing Test 0-----"
- result=`curl -v "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 0a passes\n";}else{print "test 1 fails\n"}}'
- result=`curl -v "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 0b passes\n";}else{print "test 2 fails\n"}}'
- echo "----------"
- fi
- #The following tests focus on playing around with different values of the client-ip header. These are to test various combinations
- # of values the "client-ip" header might have.
- #Rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should properly authenticate.
- result=`curl -v -H "client-ip:227.0.0.1 $myIp 32" "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 1 passes\n";}else{print "test 1 fails\n"}}'
- result=`curl -v -H "client-ip:227.0.0.1 32 $myIp" "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 2 passes\n";}else{print "test 2 fails\n"}}'
- #Rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should properly authenticate.
- result=`curl -v -H "client-ip:$myIp" "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 3 passes\n";}else{print "test 3 fails\n"}}'
- result=`curl -v -H "client-ip:$myIp" "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 4 passes\n";}else{print "test 4 fails\n"}}'
- #Attempt to rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should fail to authenticate.
- result=`curl -v -H "client-ip:227.0.0.1" "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 5 passes\n";}else{print "test 5 fails\n"}}'
- result=`curl -v -H "client-ip:227.0.0.1 23.23.23.23 2" "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 6 passes\n";}else{print "test 6 fails\n"}}'
- #Attempt to rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should fail to authenticate.
- result=`curl -v "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 7 passes\n";}else{print "test 7 fails\n"}}'
- result=`curl -v -H "client-ip:" "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 8 passes\n";}else{print "test 8 fails\n"}}'
- #Attempt to rename email billp@pennwell.com to billybob@bob.gov. Request should fail to authenticate.
- result=`curl -v -H "client-ip: " "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
- echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 9 passes\n";}else{print "test 9 fails\n"}}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement