summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/ssl_test
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2016-03-08 21:28:30 +0000
committerGordon Sim <gsim@apache.org>2016-03-08 21:28:30 +0000
commite7deaaa742c880fb5bd78f62c2cebc9b43bf4019 (patch)
tree7b89767792edabc0757799bc7991fbe772813dae /qpid/cpp/src/tests/ssl_test
parent92e6d3147fb77dc9a16db666a7716d3446b5a8f9 (diff)
downloadqpid-python-e7deaaa742c880fb5bd78f62c2cebc9b43bf4019.tar.gz
QPID-7130: added test for retrieving authenticated username when using ssl
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1734164 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/ssl_test')
-rwxr-xr-xqpid/cpp/src/tests/ssl_test6
1 files changed, 6 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/ssl_test b/qpid/cpp/src/tests/ssl_test
index d681059495..46068afefb 100755
--- a/qpid/cpp/src/tests/ssl_test
+++ b/qpid/cpp/src/tests/ssl_test
@@ -222,11 +222,17 @@ URL=amqp:ssl:$TEST_HOSTNAME:$PORT2
MSG2=`./qpid-receive -b $URL --connection-options "{ssl-cert-name: $TEST_CLIENT_CERT }" -a "bar;{create:always}" --messages 1`
test "$MSG2" = "hello" || { echo "receive failed '$MSG2' != 'hello'"; exit 1; }
+
## Make sure that connect fails with an invalid SSL cert-name
./qpid-send -b $URL --connection-options "{ssl-cert-name: pignose }" --content-string=hello -a "baz;{create:always}" 2>/dev/null 1>/dev/null
MSG3=`./qpid-receive -b $URL --connection-options "{ssl-cert-name: pignose }" -a "baz;{create:always}" --messages 1 2>/dev/null`
test "$MSG3" = "" || { echo "receive succeeded without valid ssl cert '$MSG3' != ''"; exit 1; }
+## Set the userid in the message to the authenticated username
+./qpid-send -b $URL --connection-options "{ssl-cert-name: $TEST_CLIENT_CERT }" --auto-user-id true --content-string=hello -a "bar;{create:always}"
+RECEIVED_USER=`./qpid-receive -b $URL --connection-options "{ssl-cert-name: $TEST_CLIENT_CERT }" -a "bar;{create:always}" --messages 1 --print-headers true | awk '/UserId/{print $2}'`
+test "$RECEIVED_USER" = $TEST_CLIENT_CERT || { echo "user id not as expected: $RECEIVED_USER"; exit 1; }
+
stop_brokers
# Test ssl muxed with plain TCP on the same connection