Virgil Security C++ SDK
Public Member Functions | Static Public Member Functions | List of all members
virgil::sdk::jwt::Jwt Class Reference

Class implementing AccessTokenInterface in terms of Virgil JWT. More...

#include <Jwt.h>

Inheritance diagram for virgil::sdk::jwt::Jwt:
virgil::sdk::jwt::interfaces::AccessTokenInterface

Public Member Functions

 Jwt (JwtHeaderContent headerContent, JwtBodyContent bodyContent, VirgilByteArray signatureContent)
 Constructor. More...
 
const JwtHeaderContentheaderContent () const
 Getter. More...
 
const JwtBodyContentbodyContent () const
 Getter. More...
 
const VirgilByteArray & signatureContent () const
 Getter. More...
 
const std::string & stringRepresentation () const
 Provides string representation of token. More...
 
const std::string & identity () const
 Extracts identity. More...
 
const VirgilByteArray & dataToSign () const
 Returns JWT data that should be signed. More...
 
bool isExpired (std::time_t date=std::time(0)) const
 Returns whether or not token is expired. More...
 
- Public Member Functions inherited from virgil::sdk::jwt::interfaces::AccessTokenInterface
virtual ~AccessTokenInterface ()=default
 Virtual destructor.
 

Static Public Member Functions

static Jwt parse (const std::string &stringRepresentation)
 Initializes Jwt from its string representation. More...
 
static VirgilByteArray dataToSign (const JwtHeaderContent &headerContent, const JwtBodyContent &bodyContent)
 Returns JWT data that should be signed. More...
 

Detailed Description

Class implementing AccessTokenInterface in terms of Virgil JWT.

Constructor & Destructor Documentation

virgil::sdk::jwt::Jwt::Jwt ( JwtHeaderContent  headerContent,
JwtBodyContent  bodyContent,
VirgilByteArray  signatureContent 
)

Constructor.

Parameters
headerContentJwtHeaderContent representing header of Jwt
bodyContentJwtBodyContent representing body of Jwt
signatureContentsignature data of Jwt

Member Function Documentation

const JwtBodyContent& virgil::sdk::jwt::Jwt::bodyContent ( ) const

Getter.

Returns
JwtBodyContent representing body of Jwt
const VirgilByteArray& virgil::sdk::jwt::Jwt::dataToSign ( ) const

Returns JWT data that should be signed.

Returns
JWT data that should be signed
static VirgilByteArray virgil::sdk::jwt::Jwt::dataToSign ( const JwtHeaderContent headerContent,
const JwtBodyContent bodyContent 
)
static

Returns JWT data that should be signed.

Parameters
headerContentJwtHeaderContent representing header of Jwt
bodyContentJwtBodyContent representing body of Jwt
Returns
JWT data that should be signed
const JwtHeaderContent& virgil::sdk::jwt::Jwt::headerContent ( ) const

Getter.

Returns
JwtHeaderContent representing header of Jwt
const std::string& virgil::sdk::jwt::Jwt::identity ( ) const
virtual

Extracts identity.

Returns
std::string with identity

Implements virgil::sdk::jwt::interfaces::AccessTokenInterface.

bool virgil::sdk::jwt::Jwt::isExpired ( std::time_t  date = std::time(0)) const

Returns whether or not token is expired.

Parameters
datestd::time with current date
Returns
true if token is expired, false otherwise
static Jwt virgil::sdk::jwt::Jwt::parse ( const std::string &  stringRepresentation)
static

Initializes Jwt from its string representation.

Parameters
stringRepresentationmust be equal to base64UrlEncode(JWT Header) + "." + base64UrlEncode(JWT Body) + "." + base64UrlEncode(Jwt Signature)
Returns
Jwt instance
const VirgilByteArray& virgil::sdk::jwt::Jwt::signatureContent ( ) const

Getter.

Returns
signature data of Jwt
const std::string& virgil::sdk::jwt::Jwt::stringRepresentation ( ) const
virtual

Provides string representation of token.

Returns
string representation of token

Implements virgil::sdk::jwt::interfaces::AccessTokenInterface.


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