From ba3f70390a1e7210195c41e3afa3e7fe1511eb96 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 3 Aug 2021 21:58:36 +0200 Subject: restructure configuration, move bank account credentials from exchange-account-XXX to exchange-accountcredentials-XXX --- .../test-taler-exchange-aggregator-postgres.conf | 8 ++- .../test-taler-exchange-wirewatch-postgres.conf | 9 ++- src/testing/test_auditor_api.conf | 9 ++- src/testing/test_bank_api.c | 9 +-- src/testing/test_bank_api_fakebank.conf | 2 + src/testing/test_bank_api_nexus.conf | 3 +- src/testing/test_bank_api_pybank.conf | 3 +- src/testing/test_bank_api_pybank_twisted.conf | 9 +-- src/testing/test_exchange_api.conf | 10 +++- .../test_exchange_api_keys_cherry_picking.conf | 8 ++- src/testing/test_exchange_api_twisted.conf | 8 ++- src/testing/testing_api_helpers_bank.c | 64 ++++++++++++++++------ 12 files changed, 94 insertions(+), 48 deletions(-) (limited to 'src/testing') diff --git a/src/testing/test-taler-exchange-aggregator-postgres.conf b/src/testing/test-taler-exchange-aggregator-postgres.conf index 2c03c5db7..7f277629d 100644 --- a/src/testing/test-taler-exchange-aggregator-postgres.conf +++ b/src/testing/test-taler-exchange-aggregator-postgres.conf @@ -70,13 +70,15 @@ LEGAL_RESERVE_EXPIRATION_TIME = 7 years # What is the account URL? PAYTO_URI = "payto://x-taler-bank/localhost/2" +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +[exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:8082/2/" WIRE_GATEWAY_AUTH_METHOD = basic USERNAME = Exchange PASSWORD = x -ENABLE_DEBIT = YES -ENABLE_CREDIT = YES -TALER_BANK_AUTH_METHOD = NONE + [bank] HTTP_PORT = 8082 diff --git a/src/testing/test-taler-exchange-wirewatch-postgres.conf b/src/testing/test-taler-exchange-wirewatch-postgres.conf index 6a9639897..d42f9d445 100644 --- a/src/testing/test-taler-exchange-wirewatch-postgres.conf +++ b/src/testing/test-taler-exchange-wirewatch-postgres.conf @@ -56,17 +56,16 @@ BASE_URL = "http://localhost:8083/" PORT = 8083 [exchange-account-1] - # What is the account URL? PAYTO_URI = "payto://x-taler-bank/localhost/2" +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +[exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:8082/2/" WIRE_GATEWAY_AUTH_METHOD = basic USERNAME = Exchange PASSWORD = x -PLUGIN = "taler_bank" -ENABLE_DEBIT = YES -ENABLE_CREDIT = YES -TALER_BANK_AUTH_METHOD = NONE [bank] HTTP_PORT = 8082 diff --git a/src/testing/test_auditor_api.conf b/src/testing/test_auditor_api.conf index 4140aeb42..03a5e2453 100644 --- a/src/testing/test_auditor_api.conf +++ b/src/testing/test_auditor_api.conf @@ -57,6 +57,8 @@ CONFIG = "postgres:///talercheck" [exchange-account-1] # What is the URL of our account? PAYTO_URI = "payto://x-taler-bank/localhost/42" + +[exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:8082/42/" [bank] @@ -66,17 +68,18 @@ HTTP_PORT = 8082 [exchange-account-2] # What is the bank account (with the "Taler Bank" demo system)? -WIRE_GATEWAY_URL = "http://localhost:8082/2/" PAYTO_URI = "payto://x-taler-bank/localhost/2" +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES # Authentication information for basic authentication +[exchange-accountcredentials-2] +WIRE_GATEWAY_URL = "http://localhost:8082/2/" WIRE_GATEWAY_AUTH_METHOD = "basic" USERNAME = user PASSWORD = pass -ENABLE_DEBIT = YES -ENABLE_CREDIT = YES # Sections starting with "coin_" specify which denominations diff --git a/src/testing/test_bank_api.c b/src/testing/test_bank_api.c index 68c12aff3..e5a125894 100644 --- a/src/testing/test_bank_api.c +++ b/src/testing/test_bank_api.c @@ -216,10 +216,11 @@ main (int argc, TALER_LOG_DEBUG ("Running with Nexus.\n"); with_libeufin = GNUNET_YES; cfgfile = CONFIG_FILE_NEXUS; - if (GNUNET_OK != TALER_TESTING_prepare_nexus (CONFIG_FILE_NEXUS, - GNUNET_YES, - "exchange-account-2", - &bc)) + if (GNUNET_OK != + TALER_TESTING_prepare_nexus (CONFIG_FILE_NEXUS, + GNUNET_YES, + "exchange-account-2", + &bc)) { GNUNET_break (0); return 77; diff --git a/src/testing/test_bank_api_fakebank.conf b/src/testing/test_bank_api_fakebank.conf index 78f9ecbd7..b97423987 100644 --- a/src/testing/test_bank_api_fakebank.conf +++ b/src/testing/test_bank_api_fakebank.conf @@ -5,6 +5,8 @@ currency = KUDOS [exchange-account-2] PAYTO_URI = payto://x-taler-bank/localhost/2 + +[exchange-accountcredentials-2] WIRE_GATEWAY_URL = "http://localhost:8081/2/" WIRE_GATEWAY_AUTH_METHOD = basic USERNAME = Exchange diff --git a/src/testing/test_bank_api_nexus.conf b/src/testing/test_bank_api_nexus.conf index e9a64e2a1..c514170e1 100644 --- a/src/testing/test_bank_api_nexus.conf +++ b/src/testing/test_bank_api_nexus.conf @@ -5,7 +5,8 @@ currency = KUDOS [exchange-account-2] PAYTO_URI = payto://iban/BIC/ES9121000418450200051332?receiver-name=Exchange -METHOD = iban + +[exchange-accountcredentials-2] WIRE_GATEWAY_URL = http://localhost:5001/facades/my-facade/taler/ WIRE_GATEWAY_AUTH_METHOD = basic # the exchange authenticates as the 'admin' user, diff --git a/src/testing/test_bank_api_pybank.conf b/src/testing/test_bank_api_pybank.conf index 93169d2fd..6603ba8a5 100644 --- a/src/testing/test_bank_api_pybank.conf +++ b/src/testing/test_bank_api_pybank.conf @@ -5,7 +5,8 @@ currency = KUDOS [exchange-account-2] PAYTO_URI = payto://x-taler-bank/localhost/Exchange -METHOD = x-taler-bank + +[exchange-accountcredentials-2] WIRE_GATEWAY_URL = "http://localhost:8081/taler-wire-gateway/Exchange/" WIRE_GATEWAY_AUTH_METHOD = basic USERNAME = Exchange diff --git a/src/testing/test_bank_api_pybank_twisted.conf b/src/testing/test_bank_api_pybank_twisted.conf index 3a7b08c98..d89cf0469 100644 --- a/src/testing/test_bank_api_pybank_twisted.conf +++ b/src/testing/test_bank_api_pybank_twisted.conf @@ -18,31 +18,26 @@ UNIXPATH = /tmp/taler-service-twister.sock UNIX_MATCH_UID = NO UNIX_MATCH_GID = YES - [auditor] BASE_URL = "http://localhost:8083/" [taler] currency = KUDOS - [bank] serve = http http_port = 8081 database = postgres:///talercheck - [exchange-account-1] PAYTO_URI = payto://x-taler-bank/localhost/1 [exchange-account-2] PAYTO_URI = payto://x-taler-bank/localhost/Exchange + +[exchange-accountcredentials-2] WIRE_GATEWAY_URL = "http://localhost:8888/taler-wire-gateway/Exchange/" WIRE_GATEWAY_AUTH_METHOD = basic USERNAME = Exchange PASSWORD = x - - -[bank] -HTTP_PORT = 8081 diff --git a/src/testing/test_exchange_api.conf b/src/testing/test_exchange_api.conf index 8c883c49c..a1b743658 100644 --- a/src/testing/test_exchange_api.conf +++ b/src/testing/test_exchange_api.conf @@ -57,18 +57,22 @@ CONFIG = "postgres:///talercheck" [exchange-account-1] # What is the URL of our account? PAYTO_URI = "payto://x-taler-bank/localhost/42" -WIRE_GATEWAY_URL = "http://localhost:9081/42/" # ENABLE_CREDIT = YES +[exchange-accountcredentials-1] +WIRE_GATEWAY_URL = "http://localhost:9081/42/" + [exchange-account-2] # What is the bank account (with the "Taler Bank" demo system)? PAYTO_URI = "payto://x-taler-bank/localhost/2" +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +[exchange-accountcredentials-2] WIRE_GATEWAY_AUTH_METHOD = basic USERNAME = Exchange PASSWORD = x WIRE_GATEWAY_URL = "http://localhost:9081/2/" -ENABLE_DEBIT = YES -ENABLE_CREDIT = YES [bank] HTTP_PORT = 9081 diff --git a/src/testing/test_exchange_api_keys_cherry_picking.conf b/src/testing/test_exchange_api_keys_cherry_picking.conf index e7a56f3c7..d7dd95352 100644 --- a/src/testing/test_exchange_api_keys_cherry_picking.conf +++ b/src/testing/test_exchange_api_keys_cherry_picking.conf @@ -57,18 +57,22 @@ CONFIG = "postgres:///talercheck" [exchange-account-1] PAYTO_URI = payto://x-taler-bank/localhost/42 + +[exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:9082/42/" [exchange-account-2] PAYTO_URI = payto://x-taler-bank/localhost/2 +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +[exchange-accountcredentials-2] WIRE_GATEWAY_URL = "http://localhost:9082/2/" # Authentication information for basic authentication TALER_BANK_AUTH_METHOD = "basic" USERNAME = user PASSWORD = pass -ENABLE_DEBIT = YES -ENABLE_CREDIT = YES [bank] HTTP_PORT=8082 diff --git a/src/testing/test_exchange_api_twisted.conf b/src/testing/test_exchange_api_twisted.conf index 2d4fc517b..a41cfd43c 100644 --- a/src/testing/test_exchange_api_twisted.conf +++ b/src/testing/test_exchange_api_twisted.conf @@ -49,17 +49,21 @@ CONFIG = "postgres:///talercheck" [exchange-account-1] # What is the URL of our account? PAYTO_URI = "payto://x-taler-bank/localhost/42" + +[exchange-accountcredentials-1] WIRE_GATEWAY_URL = "http://localhost:9081/42/" WIRE_GATEWAY_AUTH_METHOD = NONE [exchange-account-2] PAYTO_URI = payto://x-taler-bank/localhost/2 +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +[exchange-accountcredentials-2] WIRE_GATEWAY_URL = "http://localhost:8082/2/" WIRE_GATEWAY_AUTH_METHOD = BASIC USERNAME = user PASSWORD = pass -ENABLE_DEBIT = YES -ENABLE_CREDIT = YES [bank] HTTP_PORT = 8082 diff --git a/src/testing/testing_api_helpers_bank.c b/src/testing/testing_api_helpers_bank.c index a82bcbfe3..d7cce01bb 100644 --- a/src/testing/testing_api_helpers_bank.c +++ b/src/testing/testing_api_helpers_bank.c @@ -292,10 +292,14 @@ TALER_TESTING_prepare_nexus (const char *config_filename, char *database = NULL; // silence compiler char *exchange_payto_uri; + GNUNET_assert (0 == + strncasecmp (config_section, + "exchange-account-", + strlen ("exchange-account-"))); cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != - GNUNET_CONFIGURATION_load (cfg, config_filename)) + GNUNET_CONFIGURATION_load (cfg, + config_filename)) { GNUNET_CONFIGURATION_destroy (cfg); GNUNET_break (0); @@ -357,14 +361,25 @@ TALER_TESTING_prepare_nexus (const char *config_filename, } } - if (GNUNET_OK != - TALER_BANK_auth_parse_cfg (cfg, - config_section, - &bc->exchange_auth)) { - GNUNET_break (0); - GNUNET_CONFIGURATION_destroy (cfg); - return GNUNET_SYSERR; + char *csn; + + GNUNET_asprintf (&csn, + "exchange-accountcredentials-%s", + &config_section[strlen ("exchange-account-")]); + + + if (GNUNET_OK != + TALER_BANK_auth_parse_cfg (cfg, + csn, + &bc->exchange_auth)) + { + GNUNET_break (0); + GNUNET_CONFIGURATION_destroy (cfg); + GNUNET_free (csn); + return GNUNET_SYSERR; + } + GNUNET_free (csn); } GNUNET_CONFIGURATION_destroy (cfg); bc->exchange_payto = exchange_payto_uri; @@ -400,10 +415,15 @@ TALER_TESTING_prepare_bank (const char *config_filename, char *database; char *exchange_payto_uri; + GNUNET_assert (0 == + strncasecmp (config_section, + "exchange-account-", + strlen ("exchange-account-"))); cfg = GNUNET_CONFIGURATION_create (); if (GNUNET_OK != - GNUNET_CONFIGURATION_load (cfg, config_filename)) + GNUNET_CONFIGURATION_load (cfg, + config_filename)) { GNUNET_CONFIGURATION_destroy (cfg); GNUNET_break (0); @@ -522,14 +542,24 @@ TALER_TESTING_prepare_bank (const char *config_filename, } GNUNET_OS_process_destroy (dbreset_proc); } - if (GNUNET_OK != - TALER_BANK_auth_parse_cfg (cfg, - config_section, - &bc->exchange_auth)) { - GNUNET_break (0); - GNUNET_CONFIGURATION_destroy (cfg); - return GNUNET_SYSERR; + char *csn; + + GNUNET_asprintf (&csn, + "exchange-accountcredentials-%s", + &config_section[strlen ("exchange-account-")]); + + if (GNUNET_OK != + TALER_BANK_auth_parse_cfg (cfg, + csn, + &bc->exchange_auth)) + { + GNUNET_break (0); + GNUNET_free (csn); + GNUNET_CONFIGURATION_destroy (cfg); + return GNUNET_SYSERR; + } + GNUNET_free (csn); } GNUNET_CONFIGURATION_destroy (cfg); bc->exchange_payto = exchange_payto_uri; -- cgit v1.2.3