ORE Studio 0.0.4
Loading...
Searching...
No Matches
Static Public Member Functions | Public Attributes | List of all members
jwt_claims Struct Referencefinal

Represents the claims extracted from a JWT token. More...

#include <jwt_claims.hpp>

Collaboration diagram for jwt_claims:
Collaboration graph

Static Public Member Functions

static jwt_claims with_ttl (std::chrono::seconds ttl)
 Create a claims object with issued_at set to now and expires_at set to now + ttl.
 

Public Attributes

std::string subject
 Subject claim - typically the account ID.
 
std::string issuer
 Issuer of the token.
 
std::string audience
 Intended audience for the token.
 
std::chrono::system_clock::time_point expires_at
 Time when the token expires.
 
std::chrono::system_clock::time_point issued_at
 Time when the token was issued.
 
std::vector< std::string > roles
 User roles/permissions.
 
std::optional< std::string > username
 Optional username claim.
 
std::optional< std::string > email
 Optional email claim.
 
std::optional< std::string > session_id
 Optional session ID for tracking sessions.
 
std::optional< std::chrono::system_clock::time_point > session_start_time
 Optional session start time for efficient database updates.
 
std::optional< std::string > tenant_id
 Optional tenant ID (UUID string).
 
std::optional< std::string > party_id
 Optional party ID (UUID string, nil UUID if no party selected).
 
std::vector< std::string > visible_party_ids
 List of visible party IDs (UUID strings) for the session.
 

Detailed Description

Represents the claims extracted from a JWT token.

Member Function Documentation

◆ with_ttl()

static jwt_claims with_ttl ( std::chrono::seconds  ttl)
static

Create a claims object with issued_at set to now and expires_at set to now + ttl.

Parameters
ttlToken lifetime. The caller is responsible for choosing an appropriate duration; this function does not apply any default — it only captures the current clock and computes the expiry.

Member Data Documentation

◆ session_id

std::optional<std::string> session_id

Optional session ID for tracking sessions.

When present, identifies the database session record created during login, allowing proper session termination on logout and LRU-caching of session state by services.

◆ session_start_time

std::optional<std::chrono::system_clock::time_point> session_start_time

Optional session start time for efficient database updates.

The sessions table uses (id, start_time) as composite primary key for TimescaleDB hypertable partitioning. Including start_time in the token allows efficient UPDATE queries without full table scans.

◆ tenant_id

std::optional<std::string> tenant_id

Optional tenant ID (UUID string).

Identifies the tenant context for the authenticated account.

◆ party_id

std::optional<std::string> party_id

Optional party ID (UUID string, nil UUID if no party selected).

Identifies the active party for the session.

◆ visible_party_ids

std::vector<std::string> visible_party_ids

List of visible party IDs (UUID strings) for the session.

Contains the user's own party and all descendant parties, computed at login time via recursive CTE on the party hierarchy.