cesium-native 0.46.0
Loading...
Searching...
No Matches
CesiumITwinClient::AuthenticationToken Class Reference

An authentication token obtained from the iTwin OAuth2 flow. More...

#include <CesiumITwinClient/AuthenticationToken.h>

Public Member Functions

bool isValid () const
 Is this token currently valid?
 
int64_t getExpirationTime () const
 Returns the number of seconds since the Unix epoch representing the time that this token expires.
 
const std::string & getToken () const
 Returns the contained token string.
 
 AuthenticationToken (const std::string &token, std::string &&name, std::string &&userName, std::vector< std::string > &&scopes, int64_t notValidBefore, int64_t expires)
 Creates a new AuthenticationToken.
 

Static Public Member Functions

static CesiumUtility::Result< AuthenticationTokenparse (const std::string &tokenStr)
 Creates a new AuthenticationToken by parsing the provided JWT authentication token.
 

Detailed Description

An authentication token obtained from the iTwin OAuth2 flow.

Definition at line 15 of file AuthenticationToken.h.

Constructor & Destructor Documentation

◆ AuthenticationToken()

CesiumITwinClient::AuthenticationToken::AuthenticationToken ( const std::string & token,
std::string && name,
std::string && userName,
std::vector< std::string > && scopes,
int64_t notValidBefore,
int64_t expires )
inline

Creates a new AuthenticationToken.

This constructor assumes all the data in the provided token has already been parsed. If not, you should call parse instead.

Parameters
tokenThe full token string.
nameThe name of the token.
userNameThe name of the user this token belongs to.
scopesThe set of scopes this token is valid for.
notValidBeforeA UNIX timestamp representing the point in time that this token starts to be valid.
expiresA UNIX timestamp representing the point in time that this token stops being valid.

Definition at line 62 of file AuthenticationToken.h.

Member Function Documentation

◆ getExpirationTime()

int64_t CesiumITwinClient::AuthenticationToken::getExpirationTime ( ) const
inline

Returns the number of seconds since the Unix epoch representing the time that this token expires.

Definition at line 40 of file AuthenticationToken.h.

◆ getToken()

const std::string & CesiumITwinClient::AuthenticationToken::getToken ( ) const
inline

Returns the contained token string.

Definition at line 45 of file AuthenticationToken.h.

◆ isValid()

bool CesiumITwinClient::AuthenticationToken::isValid ( ) const

Is this token currently valid?

For the token to be valid, it must currently be after its "not valid before" date but before its expiration date.

◆ parse()

static CesiumUtility::Result< AuthenticationToken > CesiumITwinClient::AuthenticationToken::parse ( const std::string & tokenStr)
static

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

Parameters
tokenStrThe JWT authentication token.
Returns
A Result containing either the parsed AuthenticationToken or error messages.

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