Example of a receiver server with basic auth and auth headers

Example of a receiver server with basic auth and auth headers

In general the server is responsible for declaring the authentication method and the client must then follow the server's instructions on how to authenticate itself.
Server can/should explicitly tell the client that Basic Authentication is required by using the WWW-Authenticate header.

For example:
1. Client Requests a Resource
2. Server Responds with 401 Unauthorized status and a WWW-Authenticate header, indicating that Basic Authentication is required.
3. The client now knows that Basic Authentication is required and it sends a new request with the Authorization header containing the base64-encoded username and password.
4. Server Processes the Request.

Here's a very small and basic (C++) 'server' app running on port 8080.
It declares that it's preferred authentication method is Basic,
uses dummy certificates for HTTPS connection (included in the archive, PEM password is '1234') and simply prints the headers of incoming requests (see README for more information).
Source file (https_server.cpp) is also included of course.
                                                                                                                                                                                                                                                                                                          





    • Related Articles

    • JSON Fields (Protocol 1.6) \ JSON example

      Token Type Format / Value Description packetCounter Unsigned int Counter of packets. Starts from “1”. Counter starts after successful connection or after start of device. It does not matter. datetime string YYYYMMDD HHMMSSFFF YYYY - year 4 digits MM ...
    • Simple PHP receiver for multipart post

      This simple receiver may be used with any HTTP server which supports PHP extension. ff_post.php <?php $uploaddir = 'log/'; echo "<pre>\n"; $uploadfile = $uploaddir . basename($_FILES['event']['name']); if ...
    • Event response \ Event response data example

      Response contains XML document, data fields are as follows: Field Description TS Event timestamp, Unix timestamp, UTC, milliseconds MOD_TS Event timestamp, human readable CAR_ID Vehicle ID, per database id LPR Number plate as text RTIME License plate ...
    • Simple Web form for testing receiver

      ff_post_form.html <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <form method="post" enctype="multipart/form-data" action="ff_post.php"> Enter event file: <input type="file" name="event" size="40"> Enter ...
    • Power handling recommendations

      Warning! While the application is running, the power source should not be disconnected. N.B.: The application continuously works with storage (camera internal and SD card if available), it also may send events to external servers. Interrupting the ...