[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 24/29: [testing] start an oauth2 server which returns s
From: |
gnunet |
Subject: |
[taler-exchange] 24/29: [testing] start an oauth2 server which returns static birthdates |
Date: |
Mon, 03 Jul 2023 16:24:00 +0200 |
This is an automated email from the git hooks/post-receive script.
oec pushed a commit to branch master
in repository exchange.
commit d3d744a444e0afd33e7dec02a62a878aaab2c2a2
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Tue Jun 27 12:41:22 2023 +0200
[testing] start an oauth2 server which returns static birthdates
---
src/include/taler_testing_lib.h | 17 ++++++++++++++---
src/testing/testing_api_cmd_oauth.c | 36 ++++++++++++++++++++++++------------
2 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 2ef7ef60..8950e71b 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -2243,14 +2243,25 @@ TALER_TESTING_cmd_proof_kyc_oauth2 (
/**
* Starts a fake OAuth 2.0 service on @a port for testing
- * KYC processes.
+ * KYC processes which also provides a @a birthdate in a response
*
* @param label command label
* @param port the TCP port to listen on
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_oauth (const char *label,
- uint16_t port);
+TALER_TESTING_cmd_oauth_with_birthdate (const char *label,
+ const char *birthdate,
+ uint16_t port);
+
+/**
+ * Starts a fake OAuth 2.0 service on @a port for testing
+ * KYC processes.
+ *
+ * @param label command label
+ * @param port the TCP port to listen on
+ */
+#define TALER_TESTING_cmd_oauth(label, port) \
+ TALER_TESTING_cmd_oauth_with_birthdate ((label), NULL, (port))
/* ****************** P2P payment commands ****************** */
diff --git a/src/testing/testing_api_cmd_oauth.c
b/src/testing/testing_api_cmd_oauth.c
index 0bcf2f68..fcf7e843 100644
--- a/src/testing/testing_api_cmd_oauth.c
+++ b/src/testing/testing_api_cmd_oauth.c
@@ -39,6 +39,11 @@ struct OAuthState
*/
struct MHD_Daemon *mhd;
+ /**
+ * Birthdate that the oauth server should return in a response, may be NULL
+ */
+ const char *birthdate;
+
/**
* Port to listen on.
*/
@@ -172,28 +177,33 @@ handler_cb (void *cls,
void **con_cls)
{
struct RequestCtx *rc = *con_cls;
+ struct OAuthState *oas = cls;
unsigned int hc;
json_t *body;
- (void) cls;
(void) version;
if (0 == strcasecmp (method,
MHD_HTTP_METHOD_GET))
{
+ json_t *data =
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("id",
+ "XXXID12345678"),
+ GNUNET_JSON_pack_string ("first_name",
+ "Bob"),
+ GNUNET_JSON_pack_string ("last_name",
+ "Builder"));
+ if (NULL != oas->birthdate)
+ json_object_set_new (data,
+ "birthdate",
+ json_string_nocheck (oas->birthdate));
+
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string (
"status",
"success"),
GNUNET_JSON_pack_object_steal (
- "data",
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("id",
- "XXXID12345678"),
- GNUNET_JSON_pack_string ("first_name",
- "Bob"),
- GNUNET_JSON_pack_string ("last_name",
- "Builder")
- )));
+ "data", data));
return TALER_MHD_reply_json_steal (connection,
body,
MHD_HTTP_OK);
@@ -368,13 +378,15 @@ oauth_cleanup (void *cls,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_oauth (const char *label,
- uint16_t port)
+TALER_TESTING_cmd_oauth_with_birthdate (const char *label,
+ const char *birthdate,
+ uint16_t port)
{
struct OAuthState *oas;
oas = GNUNET_new (struct OAuthState);
oas->port = port;
+ oas->birthdate = birthdate;
{
struct TALER_TESTING_Command cmd = {
.cls = oas,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] 15/29: -free spec, (continued)
- [taler-exchange] 15/29: -free spec, gnunet, 2023/07/03
- [taler-exchange] 23/29: [age-withdraw] added handlers for age-withdraw to router, gnunet, 2023/07/03
- [taler-exchange] 29/29: Merge branch 'master' into age-withdraw, gnunet, 2023/07/03
- [taler-exchange] 28/29: [age-withdraw] added library function for age-withdraw, gnunet, 2023/07/03
- [taler-exchange] 27/29: added TALER_adult_age(struct TALER_AgeMask *mask), gnunet, 2023/07/03
- [taler-exchange] 12/29: [age-withdraw] age-withdraw commit- and reveal-handlers implemented, 12/n, gnunet, 2023/07/03
- [taler-exchange] 22/29: -rename variable, gnunet, 2023/07/03
- [taler-exchange] 25/29: [auditor] use the date for the report-directory, gnunet, 2023/07/03
- [taler-exchange] 26/29: -update author, gnunet, 2023/07/03
- [taler-exchange] 21/29: -fix typo, gnunet, 2023/07/03
- [taler-exchange] 24/29: [testing] start an oauth2 server which returns static birthdates,
gnunet <=