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

Class responsible for JWT generation. More...

#include <JwtGenerator.h>

Public Member Functions

 JwtGenerator (crypto::keys::PrivateKey apiKey, std::string apiPublicKeyIdentifier, std::shared_ptr< crypto::Crypto > crypto, std::string appId, int ttl)
 Constructor. More...
 
Jwt generateToken (const std::string &identity, const std::unordered_map< std::string, std::string > &additionalData=std::unordered_map< std::string, std::string >()) const
 Generates new JWT. More...
 
const crypto::keys::PrivateKeyapiKey () const
 Getter. More...
 
const std::string & apiPublicKeyIdentifier () const
 Getter. More...
 
const std::shared_ptr< crypto::Crypto > & crypto () const
 Getter. More...
 
const std::string & appId () const
 Application Id. More...
 
int ttl () const
 Getter. More...
 

Detailed Description

Class responsible for JWT generation.

Constructor & Destructor Documentation

virgil::sdk::jwt::JwtGenerator::JwtGenerator ( crypto::keys::PrivateKey  apiKey,
std::string  apiPublicKeyIdentifier,
std::shared_ptr< crypto::Crypto crypto,
std::string  appId,
int  ttl 
)

Constructor.

Parameters
apiKeyApi Private Key for signing generated tokens. Can be taken here
apiPublicKeyIdentifierPublic Key identifier of Api Key. Can be taken here
cryptostd::shared_ptr to Crypto instance
appIdApplication Id. Can be taken here
ttlLifetime of generated tokens

Member Function Documentation

const crypto::keys::PrivateKey& virgil::sdk::jwt::JwtGenerator::apiKey ( ) const

Getter.

Returns
Api Private Key Generator uses for signing generated tokens
Note
Can be taken here
const std::string& virgil::sdk::jwt::JwtGenerator::apiPublicKeyIdentifier ( ) const

Getter.

Returns
Public Key identifier of Api Key
Note
Can be taken here
const std::string& virgil::sdk::jwt::JwtGenerator::appId ( ) const

Application Id.

Returns
Can be taken here
const std::shared_ptr<crypto::Crypto>& virgil::sdk::jwt::JwtGenerator::crypto ( ) const

Getter.

Returns
std::shared_ptr to Crypto instance
Jwt virgil::sdk::jwt::JwtGenerator::generateToken ( const std::string &  identity,
const std::unordered_map< std::string, std::string > &  additionalData = std::unordered_map< std::string, std::string >() 
) const

Generates new JWT.

Parameters
identitystd::string with identity to generate with
additionalDatastd::unordered_map with additional data
Returns
generated and signed Jwt
int virgil::sdk::jwt::JwtGenerator::ttl ( ) const

Getter.

Returns
Lifetime of generated tokens

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