aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-11-11 17:59:02 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-11-11 17:59:02 +0100
commitc85248ad8620b2ca1a0a52d32c27f278e336f7cf (patch)
tree78b824dce7ee9616d1435f3327eac047e84fade7
parent4d897e224887dfea2b6f3a90dc582532c6601812 (diff)
Add fake-login
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--agl-identity-service/src/agl-identity-binding.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/agl-identity-service/src/agl-identity-binding.c b/agl-identity-service/src/agl-identity-binding.c
index 1f9cf20..39ead30 100644
--- a/agl-identity-service/src/agl-identity-binding.c
+++ b/agl-identity-service/src/agl-identity-binding.c
@@ -185,6 +185,15 @@ static void logout (struct afb_req request)
afb_req_success(request, NULL, NULL);
}
+static void fake_login (struct afb_req request)
+{
+ struct json_object *desc = afb_req_json(request);
+ do_logout();
+ if (desc)
+ do_login(desc);
+ afb_req_success(request, NULL, NULL);
+}
+
static void get (struct afb_req request)
{
afb_req_success(request, json_object_get(current_identity), NULL);
@@ -262,6 +271,7 @@ static const struct afb_verb_v2 verbs[]=
{
{"subscribe" , subscribe , NULL, "subscribe to events" , AFB_SESSION_NONE },
{"unsubscribe", unsubscribe , NULL, "unsubscribe to events" , AFB_SESSION_NONE },
+ {"fake-login" , fake_login , NULL, "fake a login" , AFB_SESSION_NONE },
{"logout" , logout , NULL, "log the current user out", AFB_SESSION_NONE },
{"get" , get , NULL, "get data" , AFB_SESSION_NONE },
{NULL}