cesium-native 0.56.0
Loading...
Searching...
No Matches
CesiumIonClient::LoginToken Class Reference

A login token for interacting with the Cesium ion REST API, obtained from the OAuth authentication flow. More...

#include <CesiumIonClient/LoginToken.h>

Public Member Functions

bool isValid () const
 Returns whether this token is currently valid.
 
std::optional< std::time_t > getExpirationTime () const
 Returns the time that this token expires, represented as a number of seconds since the Unix epoch.
 
const std::string & getToken () const
 Returns the contained token string.
 
 LoginToken (const std::string &token, const std::optional< std::time_t > &expirationTime)
 Creates a new LoginToken.
 

Static Public Member Functions

static CesiumUtility::Result< LoginTokenparse (const std::string &tokenString)
 Creates a new LoginToken by parsing the provided JWT authentication token.
 

Detailed Description

A login token for interacting with the Cesium ion REST API, obtained from the OAuth authentication flow.

These tokens have a limited duration and are scoped to a user's account. This is distinct from a Cesium ion Token, which is valid until revoked by the user and is scoped to specific assets and endpoints.

Definition at line 21 of file LoginToken.h.

Constructor & Destructor Documentation

◆ LoginToken()

CesiumIonClient::LoginToken::LoginToken ( const std::string & token,
const std::optional< std::time_t > & expirationTime )

Creates a new LoginToken.

Parameters
tokenThe full token string.
expirationTimeA UNIX timestamp representing the point in time that this token stops being valid. If this parameter is std::nullopt, the token is assumed to never expire.

Member Function Documentation

◆ getExpirationTime()

std::optional< std::time_t > CesiumIonClient::LoginToken::getExpirationTime ( ) const

Returns the time that this token expires, represented as a number of seconds since the Unix epoch.

If the token does not expire, this method returns std::nullopt.

◆ isValid()

bool CesiumIonClient::LoginToken::isValid ( ) const

Returns whether this token is currently valid.

The token is valid up until its expiration time. If the token does not have an expiration time, this method returns true.

◆ parse()

static CesiumUtility::Result< LoginToken > CesiumIonClient::LoginToken::parse ( const std::string & tokenString)
static

Creates a new LoginToken by parsing the provided JWT authentication token.

Parameters
tokenStringThe JWT authentication token.
Returns
A Result containing either the parsed LoginToken or error messages.

The documentation for this class was generated from the following file: