summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-07-21 16:19:18 +0200
committerChristian Grothoff <grothoff@gnunet.org>2022-07-21 16:19:18 +0200
commitbbfd5f189b6db0b6b96b3e8d8d8e60f576dd0e98 (patch)
tree3f398f67427456815e3a8d1ea61e1e7c2eb2f6d2 /src
parent18eb19567bc6fff4d7d9ca165685192ef47bb6cc (diff)
downloadmerchant-bbfd5f189b6db0b6b96b3e8d8d8e60f576dd0e98.tar.gz
merchant-bbfd5f189b6db0b6b96b3e8d8d8e60f576dd0e98.tar.bz2
merchant-bbfd5f189b6db0b6b96b3e8d8d8e60f576dd0e98.zip
-add missing auth header to test
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd.c15
-rwxr-xr-xsrc/testing/initialize_taler_system.sh6
-rwxr-xr-xsrc/testing/test_merchant_instance_auth.sh14
3 files changed, 17 insertions, 18 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index edf9589c..d5bc19d6 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1140,6 +1140,7 @@ url_handler (void *cls,
MHD_HTTP_METHOD_HEAD))
method = MHD_HTTP_METHOD_GET; /* MHD will deal with the rest */
+
/* Find out the merchant backend instance for the request.
* If there is an instance, remove the instance specification
* from the beginning of the request URL. */
@@ -1171,8 +1172,8 @@ url_handler (void *cls,
(NULL != hc->instance) )
{
/* Override default instance access control */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Overriding access control\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Command-line override of access control\n");
TMH_compute_auth (TMH_default_auth,
&hc->instance->auth.auth_salt,
&hc->instance->auth.auth_hash);
@@ -1194,8 +1195,8 @@ url_handler (void *cls,
(NULL != hc->instance) )
{
/* Override default instance access control */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Overriding access control\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Command-line override of access control\n");
TMH_compute_auth (TMH_default_auth,
&hc->instance->auth.auth_salt,
&hc->instance->auth.auth_hash);
@@ -1442,11 +1443,7 @@ url_handler (void *cls,
&hc->instance->auth.auth_salt,
&hc->instance->auth.auth_hash));
else /* Are the credentials provided OK for CLI override? */
- auth_ok |= ( (use_default ||
- /* also allow default credentials if
- accessed via /instances/default/ */
- (0 == strcmp ("default",
- hc->instance->settings.id))) &&
+ auth_ok |= ( use_default &&
(NULL != TMH_default_auth) &&
(NULL != auth) &&
(! auth_malformed) &&
diff --git a/src/testing/initialize_taler_system.sh b/src/testing/initialize_taler_system.sh
index 0a822867..3970fb8d 100755
--- a/src/testing/initialize_taler_system.sh
+++ b/src/testing/initialize_taler_system.sh
@@ -149,10 +149,10 @@ echo " OK"
echo -n "Waiting for the bank"
# Wait for bank to be available (usually the slowest)
-for n in `seq 1 30`
+for n in `seq 1 300`
do
echo -n "."
- sleep 1
+ sleep 0.1
OK=0
# bank
wget --waitretry=0 --timeout=1 http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null || continue
@@ -195,7 +195,7 @@ echo -n 'Wait the exchange for gather its keys '
for n in `seq 1 50`
do
echo -n "."
- sleep 1
+ sleep 0.1
OK=0
# exchange
wget --tries=3 --waitretry=0 --timeout=1 http://localhost:8081/management/keys -o /dev/null -O $LAST_RESPONSE >/dev/null
diff --git a/src/testing/test_merchant_instance_auth.sh b/src/testing/test_merchant_instance_auth.sh
index 4ba4fc0e..b918352b 100755
--- a/src/testing/test_merchant_instance_auth.sh
+++ b/src/testing/test_merchant_instance_auth.sh
@@ -37,19 +37,20 @@ echo " OK"
kill $MERCHANT_HTTPD_PID
+wait $MERCHANT_HTTPD_PID
NEW_SECRET=different_value
-taler-merchant-httpd -a $NEW_SECRET -c $CONF -L DEBUG 2> taler-merchant-httpd.log &
+taler-merchant-httpd -a "${NEW_SECRET}" -c "${CONF}" -L DEBUG 2> taler-merchant-httpd.log &
MERCHANT_HTTPD_PID=$!
#taler-merchant-httpd -c $CONF -L DEBUG 2> taler-merchant-httpd.log &
echo -n "Waiting for the merchant..."
# Wait for merchant to be available (usually the slowest)
-for n in `seq 1 5`
+for n in `seq 1 50`
do
echo -n "."
- sleep 1
+ sleep 0.1
OK=0
# merchant
wget --waitretry=0 --timeout=1 http://localhost:9966/ -o /dev/null -O /dev/null >/dev/null || continue
@@ -61,12 +62,12 @@ echo -n "Creating order to test auth is ok..."
STATUS=$(curl -v -H "Content-Type: application/json" -X POST \
'http://localhost:9966/instances/default/private/orders' \
-H 'Authorization: Bearer secret-token:'$NEW_SECRET \
- -d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"},"inventory_products":[{"product_id":"2","quantity":1}]}' \
+ -d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"}}' \
-w "%{http_code}" -s -o $LAST_RESPONSE)
if [ "$STATUS" != "200" ]
then
- echo 'should response ok, order created. got:' $STATUS #`cat $LAST_RESPONSE`
+ echo 'should response ok, order created. got:' $STATUS `cat $LAST_RESPONSE`
exit 1
fi
@@ -74,7 +75,8 @@ ORDER_ID=`jq -e -r .order_id < $LAST_RESPONSE`
TOKEN=`jq -e -r .token < $LAST_RESPONSE`
STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
- -w "%{http_code}" -s -o $LAST_RESPONSE)
+ -H 'Authorization: Bearer secret-token:'$NEW_SECRET \
+ -w "%{http_code}" -s -o $LAST_RESPONSE)
if [ "$STATUS" != "200" ]
then