5#include <CesiumUtility/Result.h>
26 parse(
const std::string& tokenStr);
45 const std::string&
getToken()
const {
return _token; }
63 const std::string& token,
65 std::string&& userName,
66 std::vector<std::string>&& scopes,
67 int64_t notValidBefore,
70 _name(
std::move(name)),
71 _userName(
std::move(userName)),
72 _scopes(
std::move(scopes)),
73 _notValidBefore(notValidBefore),
79 std::string _userName;
80 std::vector<std::string> _scopes;
81 int64_t _notValidBefore;
An authentication token obtained from the iTwin OAuth2 flow.
static CesiumUtility::Result< AuthenticationToken > parse(const std::string &tokenStr)
Creates a new AuthenticationToken by parsing the provided JWT authentication token.
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.
const std::string & getToken() const
Returns the contained token string.
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.
Classes for interacting with the iTwin API.
Holds the result of an operation. If the operation succeeds, it will provide a value....