Use afb_token in contexts
[src/app-framework-binder.git] / src / afb-stub-ws.c
index 6a52f6f..40addd0 100644 (file)
@@ -523,15 +523,14 @@ static void server_on_call_cb(void *closure, struct afb_proto_ws_call *call, con
        wreq->call = call;
 
        /* init the context */
-       if (afb_context_connect(&wreq->xreq.context, sessionid, NULL) < 0)
+       if (afb_context_connect_validated(&wreq->xreq.context, sessionid) < 0)
                goto unconnected;
-       wreq->xreq.context.validated = 1;
        server_record_session(stubws, wreq->xreq.context.session);
        if (wreq->xreq.context.created)
                afb_session_set_autoclose(wreq->xreq.context.session, 1);
 
        /* makes the call */
-       wreq->xreq.cred = afb_cred_mixed_on_behalf_import(stubws->cred, sessionid, user_creds);
+       wreq->xreq.cred = afb_cred_mixed_on_behalf_import(stubws->cred, &wreq->xreq.context, user_creds);
        wreq->xreq.request.called_api = stubws->apiname;
        wreq->xreq.request.called_verb = verb;
        wreq->xreq.json = args;