gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: allow setting api key via confi


From: gnunet
Subject: [taler-anastasis] branch master updated: allow setting api key via configuration
Date: Mon, 16 Aug 2021 11:17:21 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 7bed96f  allow setting api key via configuration
7bed96f is described below

commit 7bed96f8e479af98db1a8a0c71b7c2ff2dc2b564
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Aug 16 11:17:19 2021 +0200

    allow setting api key via configuration
---
 src/backend/anastasis-httpd.c       | 15 +++++++++++----
 src/backend/anastasis-httpd_truth.c |  3 ++-
 src/backend/anastasis.conf          | 35 ++++++++---------------------------
 src/cli/test_reducer.conf           |  4 +++-
 src/stasis/test_anastasis_db.c      | 25 +++++++++++++++----------
 src/testing/test_anastasis_api.conf | 12 +++++++-----
 6 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 8350ee7..fd5ffc3 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -708,12 +708,12 @@ run (void *cls,
   }
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (config,
-                                             "anastasis",
+                                             "anastasis-merchant-backend",
                                              "PAYMENT_BACKEND_URL",
                                              &AH_backend_url))
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               "anastasis",
+                               "anastasis-merchant-backend",
                                "PAYMENT_BACKEND_URL");
     GNUNET_SCHEDULER_shutdown ();
     return;
@@ -726,7 +726,7 @@ run (void *cls,
                           strlen ("http://";))) )
   {
     GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                               "anastasis",
+                               "anastasis-merchant-backend",
                                "PAYMENT_BACKEND_URL",
                                "Must be HTTP(S) URL");
     GNUNET_SCHEDULER_shutdown ();
@@ -739,7 +739,7 @@ run (void *cls,
                          AH_backend_url)) )
   {
     GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                               "anastasis",
+                               "anastasis-merchant-backend",
                                "PAYMENT_BACKEND_URL",
                                "Must have domain name");
     GNUNET_SCHEDULER_shutdown ();
@@ -823,6 +823,13 @@ run (void *cls,
                              certfile,
                              keyfile,
                              keypass);
+  if (NULL == apikey)
+  {
+    (void) GNUNET_CONFIGURATION_get_value_string (config,
+                                                  "anastasis-merchant-backend",
+                                                  "API_KEY",
+                                                  &apikey);
+  }
   if (NULL != apikey)
   {
     char *auth_header;
diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index ee0f2bf..0b9f4a3 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -1192,7 +1192,8 @@ AH_handler_truth_get (
     GNUNET_free (method);
   }
 
-  if (! gc->authorization->payment_plugin_managed)
+  if ( (is_question) ||
+       (! gc->authorization->payment_plugin_managed) )
   {
     struct TALER_Amount zero_amount;
 
diff --git a/src/backend/anastasis.conf b/src/backend/anastasis.conf
index 23015ae..c10973c 100644
--- a/src/backend/anastasis.conf
+++ b/src/backend/anastasis.conf
@@ -30,7 +30,7 @@ DB = postgres
 # ANNUAL_FEE = TESTKUDOS:0.1
 
 # Number of policy uploads included in one annual fee payment
-ANNUAL_POLICY_UPLĂ„OAD_LIMIT = 64
+ANNUAL_POLICY_UPLOAD_LIMIT = 64
 
 # Insurance
 # INSURANCE = TESTKUDOS:1.0
@@ -43,35 +43,16 @@ UPLOAD_LIMIT_MB = 16
 # Cost of authentication by question
 #QUESTION_COST = EUR:0
 
-# Cost of authentication by file (only for testing purposes)
-#FILE_COST = EUR:1
-
-# Cost of authentication by E-Mail
-#EMAIL_COST = EUR:0
-
-# Cost of authentication by SMS
-#SMS_COST = EUR:0
-
-# Cost of authentication by postal
-#POSTAL_COST = EUR:0
-
-# Cost of authentication by video
-#VIDEO_COST = EUR:0
-
-#SMS authentication command which is executed
-#SMSAUTH_COMMAND = some_sms_script.sh
-
-#E-Mail authentication command which is executed
-#EMAILAUTH_COMMAND = some_email_script.sh
-
 # Fulfillment URL of the ANASTASIS service itself.
 FULFILLMENT_URL = taler://fulfillment-success
 
-# Base URL of our payment backend
-# PAYMENT_BACKEND_URL = http://localhost:9976/
-
 # Server salt 16 Byte
 # SERVER_SALT = gUfO1KGOKYIFlFQg
 
-# Supported methods
-SUPPORTED_METHODS = question
+
+[anastasis-merchant-backend]
+# Base URL of our payment backend
+# PAYMENT_BACKEND_URL = http://localhost:9976/
+
+# API Key to send to the backend for authorization
+# API_KEY =
diff --git a/src/cli/test_reducer.conf b/src/cli/test_reducer.conf
index f2a5efd..ef923bb 100644
--- a/src/cli/test_reducer.conf
+++ b/src/cli/test_reducer.conf
@@ -11,13 +11,15 @@ CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
 
 [anastasis]
 DB = postgres
-PAYMENT_BACKEND_URL = http://localhost:9966/
 ANNUAL_FEE = TESTKUDOS:4.99
 TRUTH_UPLOAD_FEE = TESTKUDOS:0.01
 UPLOAD_LIMIT_MB = 1
 ANNUAL_POLICY_UPLOAD_LIMIT = 128
 INSURANCE = TESTKUDOS:1.0
 
+[anastasis-merchant-backend]
+PAYMENT_BACKEND_URL = http://localhost:9966/
+
 [authorization-question]
 COST = TESTKUDOS:0.0
 
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 54d665e..8f11827 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -268,18 +268,23 @@ run (void *cls)
   }
   ANASTASIS_hash_answer (123,
                          &c_hash);
-  FAILIF (ANASTASIS_DB_CODE_STATUS_CHALLENGE_CODE_MISMATCH !=
-          plugin->verify_challenge_code (plugin->cls,
-                                         &truth_uuid,
-                                         &c_hash));
+  {
+    bool sat;
 
-  ANASTASIS_hash_answer (challenge_code,
-                         &c_hash);
-  FAILIF (ANASTASIS_DB_CODE_STATUS_VALID_CODE_STORED !=
-          plugin->verify_challenge_code (plugin->cls,
-                                         &truth_uuid,
-                                         &c_hash));
+    FAILIF (ANASTASIS_DB_CODE_STATUS_CHALLENGE_CODE_MISMATCH !=
+            plugin->verify_challenge_code (plugin->cls,
+                                           &truth_uuid,
+                                           &c_hash,
+                                           &sat));
 
+    ANASTASIS_hash_answer (challenge_code,
+                           &c_hash);
+    FAILIF (ANASTASIS_DB_CODE_STATUS_VALID_CODE_STORED !=
+            plugin->verify_challenge_code (plugin->cls,
+                                           &truth_uuid,
+                                           &c_hash,
+                                           &sat));
+  }
   if (-1 == result)
     result = 0;
 
diff --git a/src/testing/test_anastasis_api.conf 
b/src/testing/test_anastasis_api.conf
index 65c05b3..8befd99 100644
--- a/src/testing/test_anastasis_api.conf
+++ b/src/testing/test_anastasis_api.conf
@@ -56,11 +56,6 @@ INSURANCE = EUR:0
 
 SERVER_SALT = salty
 
-# Base URL of anastasis.
-# BASE_URL = http://localhost:8086/
-
-# Where does our payment backend run?  Must match PORT under [merchant]
-PAYMENT_BACKEND_URL = http://localhost:8080/
 
 # Annual fee we charge.
 #ANNUAL_FEE = EUR:4.99
@@ -68,6 +63,13 @@ ANNUAL_FEE = EUR:4.99
 
 TRUTH_UPLOAD_FEE = EUR:0.0
 
+# Base URL of anastasis.
+# BASE_URL = http://localhost:8086/
+
+[anastasis-merchant-backend]
+# Where does our payment backend run?  Must match PORT under [merchant]
+PAYMENT_BACKEND_URL = http://localhost:8080/
+
 # Authentication costs
 [authorization-question]
 # Cost of authentication by question

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]