function AuthenticationCallback(event) % AuthenticationCallback - Callback called by modelit.webserver.Server object for generating a % simple html response. Authentication is required for this service. % % CALL: % AuthenticationCallback(event) % % INPUT: % event: <modelit.webserver.HttpExchange> % contains the request data and methods to generate a response. % % OUTPUT: % No output, a response with a simple html string with the current time is returned. % % EXAMPLE: % server = modelit.web.server.Server(8081, @AuthenticationCallback).start() % % Open a webbrowser and type: http://localhost:8081 in the address bar % % Copyright 2020 Modelit, www.modelit.nl % Generate the response response = sprintf('<html><p>Logged in: %s</p></html>', datestr(now)); event.addResponseHeader('Content-Type', 'text/html', 'Access-Control-Allow-Origin', '*'); % cors % Send the response back to the client event.send(200, response); event.getRequestHeaders event.send(200, sprintf('<html><p style="color: red">%s</p></html>', datestr(now)))