gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: add more flexibility to endpoint


From: gnunet
Subject: [taler-exchange] branch master updated: add more flexibility to endpoint naming for KYC
Date: Sat, 16 Apr 2022 17:51:34 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new b496b8fe add more flexibility to endpoint naming for KYC
b496b8fe is described below

commit b496b8fed5bcef74e79bad7351cab98aae6a7dd7
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sat Apr 16 17:51:27 2022 +0200

    add more flexibility to endpoint naming for KYC
---
 src/exchange/taler-exchange-httpd.c           | 36 ++++++++++++++++++++++++---
 src/exchange/taler-exchange-httpd.h           |  8 +++++-
 src/exchange/taler-exchange-httpd_kyc-check.c |  4 +--
 src/exchange/taler-exchange-httpd_kyc-proof.c |  8 +++---
 src/testing/test_exchange_api.c               |  4 +--
 src/testing/test_kyc_api.conf                 |  3 ++-
 6 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index aa3a7c41..fb312959 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -1413,12 +1413,12 @@ parse_kyc_oauth_cfg (void)
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (TEH_cfg,
                                              "exchange-kyc-oauth2",
-                                             "KYC_OAUTH2_URL",
+                                             "KYC_OAUTH2_AUTH_URL",
                                              &s))
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
                                "exchange-kyc-oauth2",
-                               "KYC_OAUTH2_URL");
+                               "KYC_OAUTH2_AUTH_URL");
     return GNUNET_SYSERR;
   }
   if ( (! TALER_url_valid_charset (s)) ||
@@ -1431,12 +1431,40 @@ parse_kyc_oauth_cfg (void)
   {
     GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
                                "exchange-kyc-oauth2",
-                               "KYC_OAUTH2_URL",
+                               "KYC_OAUTH2_AUTH_URL",
                                "not a valid URL");
     GNUNET_free (s);
     return GNUNET_SYSERR;
   }
-  TEH_kyc_config.details.oauth2.url = s;
+  TEH_kyc_config.details.oauth2.auth_url = s;
+
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_string (TEH_cfg,
+                                             "exchange-kyc-oauth2",
+                                             "KYC_OAUTH2_LOGIN_URL",
+                                             &s))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "exchange-kyc-oauth2",
+                               "KYC_OAUTH2_LOGIN_URL");
+    return GNUNET_SYSERR;
+  }
+  if ( (! TALER_url_valid_charset (s)) ||
+       ( (0 != strncasecmp (s,
+                            "http://";,
+                            strlen ("http://";))) &&
+         (0 != strncasecmp (s,
+                            "https://";,
+                            strlen ("https://";))) ) )
+  {
+    GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+                               "exchange-kyc-oauth2",
+                               "KYC_OAUTH2_LOGIN_URL",
+                               "not a valid URL");
+    GNUNET_free (s);
+    return GNUNET_SYSERR;
+  }
+  TEH_kyc_config.details.oauth2.login_url = s;
 
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (TEH_cfg,
diff --git a/src/exchange/taler-exchange-httpd.h 
b/src/exchange/taler-exchange-httpd.h
index ffbce0e9..deb5b3e0 100644
--- a/src/exchange/taler-exchange-httpd.h
+++ b/src/exchange/taler-exchange-httpd.h
@@ -93,8 +93,14 @@ struct TEH_KycOptions
 
       /**
        * URL of the OAuth2.0 endpoint for KYC checks.
+       * (token/auth)
        */
-      char *url;
+      char *auth_url;
+
+      /**
+       * URL of the OAuth2.0 endpoint for KYC checks.
+       */
+      char *login_url;
 
       /**
        * URL of the user info access endpoint.
diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c 
b/src/exchange/taler-exchange-httpd_kyc-check.c
index 62ecbaab..8bc2ac19 100644
--- a/src/exchange/taler-exchange-httpd_kyc-check.c
+++ b/src/exchange/taler-exchange-httpd_kyc-check.c
@@ -395,8 +395,8 @@ TEH_handler_kyc_check (
     redirect_uri_encoded = TALER_urlencode (redirect_uri);
     GNUNET_free (redirect_uri);
     GNUNET_asprintf (&url,
-                     "%s/login?client_id=%s&redirect_uri=%s",
-                     TEH_kyc_config.details.oauth2.url,
+                     "%s?client_id=%s&redirect_uri=%s",
+                     TEH_kyc_config.details.oauth2.login_url,
                      TEH_kyc_config.details.oauth2.client_id,
                      redirect_uri_encoded);
     GNUNET_free (redirect_uri_encoded);
diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c 
b/src/exchange/taler-exchange-httpd_kyc-proof.c
index f561a95a..75ff81e9 100644
--- a/src/exchange/taler-exchange-httpd_kyc-proof.c
+++ b/src/exchange/taler-exchange-httpd_kyc-proof.c
@@ -579,8 +579,8 @@ TEH_handler_kyc_proof (
                                            "curl_easy_init");
       }
       GNUNET_asprintf (&kpc->token_url,
-                       "%stoken",
-                       TEH_kyc_config.details.oauth2.url);
+                       "%s",
+                       TEH_kyc_config.details.oauth2.auth_url);
       GNUNET_assert (CURLE_OK ==
                      curl_easy_setopt (eh,
                                        CURLOPT_URL,
@@ -603,8 +603,8 @@ TEH_handler_kyc_proof (
           char *request_uri;
 
           GNUNET_asprintf (&request_uri,
-                           "%slogin?client_id=%s",
-                           TEH_kyc_config.details.oauth2.url,
+                           "%s?client_id=%s",
+                           TEH_kyc_config.details.oauth2.login_url,
                            TEH_kyc_config.details.oauth2.client_id);
           redirect_uri = curl_easy_escape (eh,
                                            request_uri,
diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c
index 4f1e2a61..da4974f2 100644
--- a/src/testing/test_exchange_api.c
+++ b/src/testing/test_exchange_api.c
@@ -432,7 +432,7 @@ run (void *cls,
     /* Try resolving a deposit's WTID, as we never triggered
      * execution of transactions, the answer should be that
      * the exchange knows about the deposit, but has no WTID yet.
-     *///
+     */
     TALER_TESTING_cmd_track_transaction ("deposit-wtid-found",
                                          "deposit-simple",
                                          0,
@@ -458,7 +458,7 @@ run (void *cls,
      * happen here, as each deposit operation is run with a
      * fresh merchant public key, so the aggregator will treat
      * them as "different" merchants and do the wire transfers
-     * individually. *///
+     * individually. */
     CMD_EXEC_AGGREGATOR ("run-aggregator"),
     /**
      * Check all the transfers took place.
diff --git a/src/testing/test_kyc_api.conf b/src/testing/test_kyc_api.conf
index 2dce408b..539c59ec 100644
--- a/src/testing/test_kyc_api.conf
+++ b/src/testing/test_kyc_api.conf
@@ -56,7 +56,8 @@ KYC_WITHDRAW_LIMIT = EUR:8
 
 [exchange-kyc-oauth2]
 
-KYC_OAUTH2_URL = http://localhost:6666/oauth/v2/login
+KYC_OAUTH2_AUTH_URL = http://localhost:6666/oauth/v2/token
+KYC_OAUTH2_LOGIN_URL = http://localhost:6666/oauth/v2/login
 KYC_INFO_URL = http://localhost:6666/api/user/me
 KYC_OAUTH2_CLIENT_ID = taler-exchange
 KYC_OAUTH2_CLIENT_SECRET = exchange-secret

-- 
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]