From b4da3b7f3db2211e7ecca74301e26b3089fda5a2 Mon Sep 17 00:00:00 2001 From: Jose Bollo Date: Fri, 15 Nov 2019 16:21:03 +0100 Subject: Move tokens from sessions to requests Tokens are no more related to sessions. Each request provides a token. In the case of websockets or connected link, the context can record the token. Bug-AGL: SPEC-2968 Change-Id: I1442b0422584c5a5b860ddb826518b0e673612f9 Signed-off-by: Jose Bollo --- src/afb-hreq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/afb-hreq.c') diff --git a/src/afb-hreq.c b/src/afb-hreq.c index a9010b88..4d5f659c 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -43,6 +43,7 @@ #include "afb-hsrv.h" #include "afb-session.h" #include "afb-cred.h" +#include "afb-token.h" #include "verbose.h" #include "locale-root.h" @@ -966,6 +967,7 @@ int afb_hreq_init_context(struct afb_hreq *hreq) { const char *uuid; const char *token; + struct afb_token *tok; if (hreq->xreq.context.session != NULL) return 0; @@ -994,8 +996,11 @@ int afb_hreq_init_context(struct afb_hreq *hreq) } } } + tok = NULL; + if (token) + afb_token_get(&tok, token); - return afb_context_connect(&hreq->xreq.context, uuid, token); + return afb_context_connect(&hreq->xreq.context, uuid, tok); } int afb_hreq_init_cookie(int port, const char *path, int maxage) -- cgit 1.2.3-korg