@@ -205,6 +205,11 @@ void ComputeThread::try_spawn_server()
205205 throw std::logic_error (" Failed to read port from server." );
206206 }
207207 port = atoi (buffer);
208+ if (fscanf (f, " %100s" , buffer)!=1 ) {
209+ throw std::logic_error (" Failed to read authentication token from server." );
210+ }
211+ authentication_token=std::string (buffer);
212+ // std::cerr << "auth token: " << authentication_token << std::endl;
208213 }
209214 catch (Glib::SpawnError& err) {
210215 std::cerr << " Failed to start server " << argv[0 ] << " : " << err.what () << std::endl;
@@ -424,8 +429,9 @@ void ComputeThread::execute_interactive(const std::string& code)
424429 header[" interactive" ] = true ;
425430 content[" code" ] = code.c_str ();
426431
427- req[" header" ] = header;
428- req[" content" ] = content;
432+ req[" auth_token" ] = authentication_token;
433+ req[" header" ] = header;
434+ req[" content" ] = content;
429435
430436 std::ostringstream oss;
431437 oss << req << std::endl;
@@ -484,6 +490,7 @@ void ComputeThread::execute_cell(DTree::iterator it)
484490 else
485491 header[" cell_origin" ]=" server" ;
486492 header[" msg_type" ]=" execute_request" ;
493+ req[" auth_token" ]=authentication_token;
487494 req[" header" ]=header;
488495 content[" code" ]=dc.textbuf ;
489496 req[" content" ]=content;
@@ -522,6 +529,7 @@ void ComputeThread::stop()
522529 Json::Value req, header, content;
523530 header[" uuid" ]=" none" ;
524531 header[" msg_type" ]=" execute_interrupt" ;
532+ req[" auth_token" ]=authentication_token;
525533 req[" header" ]=header;
526534
527535 std::ostringstream str;
@@ -550,6 +558,7 @@ void ComputeThread::restart_kernel()
550558 header[" uuid" ]=" none" ;
551559 header[" msg_type" ]=" exit" ;
552560 header[" from_server" ] = true ;
561+ req[" auth_token" ]=authentication_token;
553562 req[" header" ]=header;
554563
555564 std::ostringstream str;
0 commit comments