This client-server application was developed as a project for a Local Networks class. It demonstrates practical implementation of communication protocols, focusing on HTTP, REST API principles, session management using cookies, and authentication with JWT tokens.
The client supports various commands, each triggering specific actions on the server:
The register
command creates a JSON object with user credentials and sends a registration request to the server.
The login
command logs in a user, sets the received cookie for subsequent requests, and validates the login.
The enter_library
command utilizes a JWT received from the server, parsing it manually, and grants access to the library.
The logout
command logs out a user, displaying a confirmation message and clearing allocated memory for the cookie and JWT.
The get_books
command retrieves all books from the library, displaying them in JSON format.
The add_book
command adds a book to the library, ensuring the user is logged in and has the necessary access.
The delete_book
command deletes a book from the library, verifying user credentials and handling errors appropriately.
The get_book
command retrieves information about a specific book from the library.
The exit
command gracefully terminates the program, closing the TCP connection and freeing allocated memory.
Please note that the server for this application is currently offline. As a result, you won't be able to run the program or interact with the server. However, you can still review the codebase and understand its implementation details, including communication flow, command handling, and usage of HTTP, cookies, and JWT tokens.
This project offers valuable insights into network programming concepts and serves as a practical exercise in building client-server applications within a local network environment.