![]() |
CARTA Backend
The backend component of CARTA
|
#include <uWebSockets/HttpContext.h>#include <string>Functions | |
| std::string | NewAuthToken () |
| Create a new authentication token. | |
| bool | ValidateAuthToken (uWS::HttpRequest *http_request, const std::string &required_token) |
| Validate an HTTP request. | |
Utilities for working with authentication tokens.
| std::string NewAuthToken | ( | ) |
Create a new authentication token.
This function generates a new random UUID and returns it as a string.
| bool ValidateAuthToken | ( | uWS::HttpRequest * | http_request, |
| const std::string & | required_token | ||
| ) |
Validate an HTTP request.
| http_request | The HTTP request to validate. |
| required_token | The token to use for authentication. |
This function checks if the provided HTTP request contains a valid authentication token that matches the required token. It supports validation through:
carta-auth-token)Bearer <token>)token)carta-auth-token)If the required token is empty, authentication is automatically approved.