From 6fce29c2dc4360da38f326c172ee2170f1688e36 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Sat, 7 Oct 2017 13:12:12 +0200 Subject: [PATCH] -fixes, add tests --- src/identity-provider/test_idp_attribute.sh | 32 ++++++++++++++++++ src/identity-provider/test_idp_consume.sh | 36 +++++++++++++++++++++ src/identity-provider/test_idp_issue.sh | 11 +++---- src/rest/rest.conf | 1 + 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100755 src/identity-provider/test_idp_attribute.sh create mode 100755 src/identity-provider/test_idp_consume.sh diff --git a/src/identity-provider/test_idp_attribute.sh b/src/identity-provider/test_idp_attribute.sh new file mode 100755 index 000000000..433dfa3c4 --- /dev/null +++ b/src/identity-provider/test_idp_attribute.sh @@ -0,0 +1,32 @@ +#!/bin/bash +trap "gnunet-arm -e -c test_idp.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_idp.conf -s PATHS -o GNUNET_HOME -f` + +# (1) PKEY1.user -> PKEY2.resu.user +# (2) PKEY2.resu -> PKEY3 +# (3) PKEY3.user -> PKEY4 + + +which timeout &> /dev/null && DO_TIMEOUT="timeout 30" + +TEST_ATTR="test" +gnunet-arm -s -c test_idp.conf +gnunet-identity -C testego -c test_idp.conf +gnunet-identity -C rpego -c test_idp.conf +TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print $3}') +gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf +gnunet-idp -e testego -a name -V John -c test_idp.conf +gnunet-arm -e -c test_idp.conf diff --git a/src/identity-provider/test_idp_consume.sh b/src/identity-provider/test_idp_consume.sh new file mode 100755 index 000000000..0d05145e0 --- /dev/null +++ b/src/identity-provider/test_idp_consume.sh @@ -0,0 +1,36 @@ +#!/bin/bash +trap "gnunet-arm -e -c test_idp.conf" SIGINT + +LOCATION=$(which gnunet-config) +if [ -z $LOCATION ] +then + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 +fi + +rm -rf `gnunet-config -c test_idp.conf -s PATHS -o GNUNET_HOME -f` + +# (1) PKEY1.user -> PKEY2.resu.user +# (2) PKEY2.resu -> PKEY3 +# (3) PKEY3.user -> PKEY4 + + +which timeout &> /dev/null && DO_TIMEOUT="timeout 30" + +TEST_ATTR="test" +gnunet-arm -s -c test_idp.conf +gnunet-identity -C testego -c test_idp.conf +gnunet-identity -C rpego -c test_idp.conf +SUBJECT_KEY=$(gnunet-identity -d -c test_idp.conf | grep rpego | awk '{print $3}') +TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print $3}') +gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf > /dev/null 2>&1 +gnunet-idp -e testego -a name -V John -c test_idp.conf > /dev/null 2>&1 +TICKET=$(gnunet-idp -e testego -i "email,name" -r $SUBJECT_KEY -c test_idp.conf | awk '{print $1}') +echo "Consuming ticket $TICKET" +gnunet-idp -e rpego -C $TICKET -c test_idp.conf +gnunet-arm -e -c test_idp.conf diff --git a/src/identity-provider/test_idp_issue.sh b/src/identity-provider/test_idp_issue.sh index 8cd1297d3..bf5783c9d 100755 --- a/src/identity-provider/test_idp_issue.sh +++ b/src/identity-provider/test_idp_issue.sh @@ -24,16 +24,15 @@ which timeout &> /dev/null && DO_TIMEOUT="timeout 30" TEST_ATTR="test" gnunet-arm -s -c test_idp.conf -gnunet-arm -i rest -c test_idp.conf +#gnunet-arm -i rest -c test_idp.conf gnunet-identity -C testego -c test_idp.conf gnunet-identity -C rpego -c test_idp.conf SUBJECT_KEY=$(gnunet-identity -d -c test_idp.conf | grep rpego | awk '{print $3}') TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print $3}') -gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf -gnunet-idp -e testego -a name -V John -c test_idp.conf +gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf > /dev/null 2>&1 +gnunet-idp -e testego -a name -V John -c test_idp.conf > /dev/null 2>&1 #gnunet-idp -e testego -D -c test_idp.conf TICKET=$(gnunet-idp -e testego -i "email,name" -r $SUBJECT_KEY -c test_idp.conf | awk '{print $1}') -curl http://localhost:7776/idp/attributes/testego -#echo "Consuming $TICKET" -gnunet-idp -e rpego -C $TICKET -c test_idp.conf +#curl http://localhost:7776/idp/attributes/testego +echo "Ticket: $TICKET" gnunet-arm -e -c test_idp.conf diff --git a/src/rest/rest.conf b/src/rest/rest.conf index 6cd013345..b86e6c1a0 100644 --- a/src/rest/rest.conf +++ b/src/rest/rest.conf @@ -1,4 +1,5 @@ [rest] +UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-rest.sock BINARY=gnunet-rest-server REST_PORT=7776 REST_ALLOW_HEADERS=Authorization,Accept,Content-Type -- 2.25.1