10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::jwk::JWKS Class Reference

#include <JWKS.h>

Detailed Description

JSON Web Key Set, a container for one or more tenduke::jwk::JWKs, indexed by the JWK key ID.

This container is thread-safe and can be used as a shared, stateful repository of keys.

Public Member Functions

void addKey (const tenduke::jwk::JWK &key)
 Adds new key to the set.
 
bool empty ()
 Checks if the key set is empty.
 
std::map< std::string, tenduke::jwk::JWKgetAllKeys ()
 Returns all contained JWKs as a map.
 
tenduke::jwk::JWK getKey (const std::string &keyId)
 Returns JWK by its id.
 
bool hasKey (const std::string &keyId)
 Checks if the set has a key with the given id.
 
void merge (const JWKS &other)
 Merges another JWKS to this key set.
 
void remove (const std::string &keyId)
 Removes key by ID.
 

Member Function Documentation

◆ addKey()

void tenduke::jwk::JWKS::addKey ( const tenduke::jwk::JWK key)

Adds new key to the set.

NOTE: Does nothing if the key already exists.

Parameters
key-

◆ empty()

bool tenduke::jwk::JWKS::empty ( )

Checks if the key set is empty.

Returns
-

◆ getAllKeys()

std::map< std::string, xdjwk::JWK > tenduke::jwk::JWKS::getAllKeys ( )

Returns all contained JWKs as a map.

Returns
map of contained JWKs. Key of the map is the JWK ID, value is the JWK.

◆ getKey()

xdjwk::JWK tenduke::jwk::JWKS::getKey ( const std::string &  keyId)

Returns JWK by its id.

Parameters
keyId-
Returns
-
Exceptions
std::out_of_rangeIf no such key

◆ hasKey()

bool tenduke::jwk::JWKS::hasKey ( const std::string &  keyId)

Checks if the set has a key with the given id.

Parameters
keyId-
Returns
-

◆ merge()

void tenduke::jwk::JWKS::merge ( const JWKS other)

Merges another JWKS to this key set.

Merge is done by the key IDs. On conflict, old key will be replaced by key from other set.

Parameters
other-

◆ remove()

void tenduke::jwk::JWKS::remove ( const std::string &  keyId)

Removes key by ID.

Parameters
keyId-

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