JWTXX
C++ library for JWT
Loading...
Searching...
No Matches
JWTXX Namespace Reference

All classes, functions and constants are here. More...

Namespaces

namespace  Validate
 Validation functions are here.
 

Classes

class  Error
 Base class for all exceptions in the library. More...
 
class  JWT
 Main class to work with JWT. More...
 
class  Key
 Represents signature algorithm Signs tokens and verifies token signatures. More...
 
class  ValidationResult
 Represents the result of validation. If validation is successfull an object of this class is equivalent to 'true' boolean value. Otherwise it is equivalent ot 'false' and contains an error message. More...
 
class  Value
 Represents a JSON value that can hold any JSON type. More...
 

Typedefs

using Validator = std::function<ValidationResult (const Value::Object&)>
 Validation function for claims.
 
using Validators = std::vector<Validator>
 A list of validators.
 

Enumerations

enum class  Algorithm {
  HS256 , HS384 , HS512 , RS256 ,
  RS384 , RS512 , ES256 , ES384 ,
  ES512 , none
}
 JWT signature algorithms. More...
 

Functions

std::ostream & operator<< (std::ostream &stream, const Algorithm &alg)
 Puts algorithm name to a stream.
 
std::ostream & operator<< (std::ostream &stream, const Value &v)
 Outputs a Value to a stream.
 
void enableOpenSSLErrors () noexcept
 Enable OpenSSL human-readable error messages. You only need to call it once, in the beginning of your program.
 
std::string algToString (Algorithm alg) noexcept
 Converts algorithm code into a string representation.
 
Algorithm stringToAlg (const std::string &value)
 Converts algorithm name into algorithm code.
 

Detailed Description

All classes, functions and constants are here.

Enumeration Type Documentation

◆ Algorithm

enum class JWTXX::Algorithm
strong

JWT signature algorithms.

Enumerator
HS256 

HMAC-based signature with SHA-256 digest

HS384 

HMAC-based signature with SHA-384 digest

HS512 

HMAC-based signature with SHA-512 digest

RS256 

RSA-based signature with SHA-256 digest

RS384 

RSA-based signature with SHA-384 digest

RS512 

RSA-based signature with SHA-512 digest

ES256 

ECDSA-based signature with SHA-256 digest

ES384 

ECDSA-based signature with SHA-384 digest

ES512 

ECDSA-based signature with SHA-512 digest

none 

no signature

Function Documentation

◆ algToString()

std::string JWTXX::algToString ( Algorithm alg)
noexcept

Converts algorithm code into a string representation.

Parameters
algalgorithm code.
Returns
string representation of the supplied code.

◆ operator<<() [1/2]

std::ostream & JWTXX::operator<< ( std::ostream & stream,
const Algorithm & alg )
inline

Puts algorithm name to a stream.

Parameters
streamthe stream;
algthe algorithm.

◆ operator<<() [2/2]

std::ostream & JWTXX::operator<< ( std::ostream & stream,
const Value & v )
inline

Outputs a Value to a stream.

Parameters
streamthe output stream;
vthe Value to output.
Returns
reference to the stream for chaining.

◆ stringToAlg()

Algorithm JWTXX::stringToAlg ( const std::string & value)

Converts algorithm name into algorithm code.

Parameters
valuealgorithm name.
Returns
algorithm code for the supplied name.
Exceptions
Error
Note
Throws if the supplied name is not valid.