cesium-native 0.46.0
|
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< AuthenticationToken > | parse (const std::string &tokenStr) |
Creates a new AuthenticationToken by parsing the provided JWT authentication token. | |
An authentication token obtained from the iTwin OAuth2 flow.
Definition at line 15 of file AuthenticationToken.h.
|
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.
token | The full token string. |
name | The name of the token. |
userName | The name of the user this token belongs to. |
scopes | The set of scopes this token is valid for. |
notValidBefore | A UNIX timestamp representing the point in time that this token starts to be valid. |
expires | A UNIX timestamp representing the point in time that this token stops being valid. |
Definition at line 62 of file AuthenticationToken.h.
|
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.
|
inline |
Returns the contained token string.
Definition at line 45 of file AuthenticationToken.h.
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.
|
static |
Creates a new AuthenticationToken by parsing the provided JWT authentication token.
tokenStr | The JWT authentication token. |
Result
containing either the parsed AuthenticationToken or error messages.