From c85248ad8620b2ca1a0a52d32c27f278e336f7cf Mon Sep 17 00:00:00 2001 From: José Bollo Date: Sat, 11 Nov 2017 17:59:02 +0100 Subject: Add fake-login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Bollo --- agl-identity-service/src/agl-identity-binding.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'agl-identity-service/src') 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} -- cgit 1.2.3-korg