1#ifndef TENDUKE_JWT_JWT_H
2#define TENDUKE_JWT_JWT_H
41 explicit JWT(std::map<std::string, std::string>
claims);
51 const std::map<std::string, std::string> &
claims,
53 const std::map<std::string, std::map<std::string, std::string>> &
mapClaims = {},
54 const std::map<std::string, std::vector<std::string>> &
arrayClaims = {}
68 bool hasClaim(
const std::string &name)
const;
75 const std::string *
claim(
const std::string &name)
const;
88 const std::string &
getStringClaim(
const std::string & claimName)
const;
95 std::int64_t
getIntClaim(
const std::string & claimName)
const;
101 const std::string &
getJWTID()
const;
152 std::map<std::string, std::string>
getMapClaim(
const std::string &name)
const;
161 std::vector<std::string>
getArrayClaim(
const std::string &name)
const;
172 std::map<std::string, std::string>
claims;
176 std::map<std::string, std::map<std::string, std::string>>
mapClaims;
Very simple JWT implementation.
Definition JWT.h:32
const std::string & getJWTID() const
Returns "JWT ID", "jti"-claim.
Definition JWT.cpp:65
const std::string & getAudience() const
Returns "Audience", "aud"-claim.
Definition JWT.cpp:83
std::map< std::string, std::map< std::string, std::string > > mapClaims
Claims with values of maps.
Definition JWT.h:176
const std::map< std::string, std::string > & getClaims() const
Returns all claims as a map.
Definition JWT.h:81
std::map< std::string, std::string > getMapClaim(const std::string &name) const
Returns a claim, which is a map.
Definition JWT.cpp:125
std::vector< std::string > getArrayClaim(const std::string &name) const
Returns a claim, which is a JSON array, as vector of strings.
Definition JWT.cpp:134
static const std::int64_t NUMBER_NOT_PRESENT
Magic value to indicate that numeric claim is not present.
Definition JWT.h:35
std::map< std::string, std::string > headerParameters
Header parameters.
Definition JWT.h:174
const std::string & getIssuer() const
Returns "Issuer", "iss"-claim.
Definition JWT.cpp:71
JWT(const JWT ©)=default
Copy-constructs new JWT instance.
std::string getHeaderParameterKID() const
Returns header-parameter KeyId ("kid"-parameter).
Definition JWT.cpp:107
std::map< std::string, std::string > claims
Claims.
Definition JWT.h:172
std::int64_t getIntClaim(const std::string &claimName) const
Returns claim value as std::int64_t.
Definition JWT.cpp:53
std::int64_t getIssuedAt() const
Returns "Issued at", "iat"-claim.
Definition JWT.cpp:95
std::map< std::string, std::string > getHeaderParameters() const
Returns header parameters.
Definition JWT.cpp:101
std::map< std::string, std::vector< std::string > > arrayClaims
Claims with values of arrays.
Definition JWT.h:178
const std::string & getSubject() const
Returns "Subject", "sub"-claim.
Definition JWT.cpp:77
const std::string & getStringClaim(const std::string &claimName) const
Returns a claim value as string.
Definition JWT.cpp:41
std::int64_t getExpirationTime() const
Returns "Expiration time", "exp"-claim.
Definition JWT.cpp:89
bool isInfinite() const
Returns true if token does expire.
Definition JWT.cpp:119
const std::string * claim(const std::string &name) const
Returns a JWT-claim by given name.
Definition JWT.cpp:29
bool hasClaim(const std::string &name) const
Checks if the JWT has given claim.
Definition JWT.cpp:23
Support for JSON Web Tokens.
Definition DefaultJWTParser.h:11
const std::string CLAIM_AUD
Claim name for "Audience".
Definition JWT.h:18
const std::string CLAIM_EXP
Claim name for "Expiration time".
Definition JWT.h:20
const std::string CLAIM_JTI
Claim name for "JWT ID".
Definition JWT.h:12
const std::string CLAIM_IAT
Claim name for "Issued at".
Definition JWT.h:22
const std::string CLAIM_SUB
Claim name for "Subject".
Definition JWT.h:16
const std::string STRING_NOT_PRESENT
Magic value to indicate that a string value is not present.
Definition JWT.h:25
const std::string CLAIM_ISS
Claim name for "Issuer".
Definition JWT.h:14
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4