CARTA Backend
The backend component of CARTA
Loading...
Searching...
No Matches
Token.cc File Reference
#include "Token.h"
#include "String.h"
#include <regex>
#include <uuid/uuid.h>
Include dependency graph for Token.cc:

Functions

std::string NewAuthToken ()
 Create a new authentication token.
 
bool ValidateAuthToken (uWS::HttpRequest *http_request, const std::string &required_token)
 Validate an HTTP request.
 

Function Documentation

◆ NewAuthToken()

std::string NewAuthToken ( )

Create a new authentication token.

This function generates a new random UUID and returns it as a string.

Here is the caller graph for this function:

◆ ValidateAuthToken()

bool ValidateAuthToken ( uWS::HttpRequest *  http_request,
const std::string &  required_token 
)

Validate an HTTP request.

This function checks if the provided HTTP request contains a valid authentication token that matches the required token. It supports validation through:

  • Cookies (carta-auth-token)
  • Authorization header (Bearer <token>)
  • URL query parameter (token)
  • Custom header (carta-auth-token)

If the required token is empty, authentication is automatically approved.

Here is the call graph for this function:
Here is the caller graph for this function: