[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: -add missing auth header to test
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: -add missing auth header to test |
Date: |
Thu, 21 Jul 2022 16:19:22 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new bbfd5f18 -add missing auth header to test
bbfd5f18 is described below
commit bbfd5f189b6db0b6b96b3e8d8d8e60f576dd0e98
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Thu Jul 21 16:19:18 2022 +0200
-add missing auth header to test
---
src/backend/taler-merchant-httpd.c | 15 ++++++---------
src/testing/initialize_taler_system.sh | 6 +++---
src/testing/test_merchant_instance_auth.sh | 14 ++++++++------
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
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: -add missing auth header to test,
gnunet <=