[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated (3095a88 -> 713dc28)
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated (3095a88 -> 713dc28) |
Date: |
Wed, 23 Sep 2020 19:04:22 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a change to branch master
in repository anastasis.
from 3095a88 removed required flag
new ee7836d added sample provider list
new 8c1e523 add_authentication action
new ce4e845 fix action
new 2381d93 modified authencation add action
new 713dc28 fix json
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
contrib/Makefile.am | 3 +-
contrib/provider-list.json | 24 ++++++++++++
src/backend/anastasis-httpd_config.c | 2 +-
src/include/anastasis.h | 2 +-
src/lib/anastasis_api_backup_redux.c | 72 +++++++++++++++++++++++++++++++++++-
5 files changed, 99 insertions(+), 4 deletions(-)
create mode 100644 contrib/provider-list.json
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index f8ea7f5..ce6ed23 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -12,4 +12,5 @@ EXTRA_DIST = \
pkgdata_DATA = \
redux.ch.json \
redux.de.json \
- redux.countries.json
+ redux.countries.json \
+ provider-list.json
diff --git a/contrib/provider-list.json b/contrib/provider-list.json
new file mode 100644
index 0000000..8e5cc82
--- /dev/null
+++ b/contrib/provider-list.json
@@ -0,0 +1,24 @@
+{
+ "anastasis-provider": [
+ {
+ "provider-id" : "anastasis_01",
+ "provider-url" : "localhost:8086/",
+ "provider-name" : "Anastasis 1"
+ },
+ {
+ "provider-id" : "anastasis_02",
+ "provider-url" : "localhost:8087/",
+ "provider-name" : "Anastasis 2"
+ },
+ {
+ "provider-id" : "anastasis_03",
+ "provider-url" : "localhost:8088/",
+ "provider-name" : "Anastasis 3"
+ },
+ {
+ "provider-id" : "anastasis_04",
+ "provider-url" : "localhost:8089/",
+ "provider-name" : "Anastasis 4"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/backend/anastasis-httpd_config.c
b/src/backend/anastasis-httpd_config.c
index 97638f9..3340c8f 100644
--- a/src/backend/anastasis-httpd_config.c
+++ b/src/backend/anastasis-httpd_config.c
@@ -45,7 +45,7 @@ AH_handler_config (struct TMH_RequestHandler *rh,
return TALER_MHD_reply_json_pack (connection,
MHD_HTTP_OK,
"{s:s, s:s, s:I, s:s, s:o, s:o, s:s}",
- "name", "anastasis"
+ "name", "anastasis",
"methods",
(char *) AH_supported_methods,
"storage_limit_in_megabytes",
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index cf590db..fa98a08 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -20,7 +20,7 @@
* @author Dominik Meister
* @author Dennis Neufeld
*/
-#include "platform.h"
+#include <gnunet/platform.h>
#include <taler/taler_json_lib.h>
#include <gnunet/gnunet_util_lib.h>
#include "anastasis_service.h"
diff --git a/src/lib/anastasis_api_backup_redux.c
b/src/lib/anastasis_api_backup_redux.c
index d6331d1..9690ece 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -36,6 +36,11 @@ json_t *redux_countries;
*/
json_t *redux_id_attr;
+/**
+ * JSON containing anastasis providers.
+ */
+json_t *provider_list;
+
/**
* Callback function FIXME: Description.
@@ -322,6 +327,37 @@ enter_user_attributes (const json_t *state,
{
json_t *new_state;
json_t *attributes = json_object_get (arguments, "identity");
+ json_t *root;
+ char *dn;
+ json_error_t error;
+
+ {
+ char *path;
+
+ path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
+ if (NULL == path)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_asprintf (&dn,
+ "%s/share/anastasis/provider-list.json",
+ path);
+ GNUNET_free (path);
+ }
+ provider_list = json_load_file (dn, JSON_COMPACT, &error);
+ if (NULL == provider_list)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to parse `%s': %s at %d:%d (%d)\n",
+ dn,
+ error.text,
+ error.line,
+ error.column,
+ error.position);
+ GNUNET_free (dn);
+ return GNUNET_SYSERR;
+ }
if (NULL == state)
{
@@ -346,6 +382,7 @@ enter_user_attributes (const json_t *state,
ANASTASIS_EC_INVALID, // FIXME: Define correct error code
NULL);
}
+ root = json_object_get (provider_list, "anastasis-provider");
json_object_set (new_state,
"backup-state",
@@ -355,6 +392,10 @@ enter_user_attributes (const json_t *state,
"identity_attributes",
attributes);
+ json_object_set_new (new_state,
+ "provider-list",
+ root);
+
cb (cb_cls,
ANASTASIS_EC_NONE,
new_state);
@@ -395,7 +436,6 @@ edit_user_attributes (const json_t *state,
NULL);
}
-
json_object_set_new (new_state,
"identity_attributes",
attributes);
@@ -473,7 +513,37 @@ add_authentication (const json_t *state,
ANASTASIS_ActionCallback cb,
void *cb_cls)
{
+ json_t *new_state;
+ json_t *methods = json_object_get (arguments, "authentication_methods");
+
+ new_state = json_deep_copy (state);
+ if (NULL == new_state)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+ if (NULL == methods)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+ json_object_set (new_state,
+ "backup-state",
+ json_string ("ReduxAuthenticationAddedState"));
+
+ json_object_set_new (new_state,
+ "authentication_methods",
+ methods);
+
+ cb (cb_cls,
+ ANASTASIS_EC_NONE,
+ new_state);
+ json_decref (new_state);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (3095a88 -> 713dc28),
gnunet <=
- [taler-anastasis] 04/05: modified authencation add action, gnunet, 2020/09/23
- [taler-anastasis] 01/05: added sample provider list, gnunet, 2020/09/23
- [taler-anastasis] 02/05: add_authentication action, gnunet, 2020/09/23
- [taler-anastasis] 03/05: fix action, gnunet, 2020/09/23
- [taler-anastasis] 05/05: fix json, gnunet, 2020/09/23