mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-15 01:08:31 +00:00
JWT encoding
This commit is contained in:
parent
e7d52450d6
commit
8277e2cbd3
5 changed files with 156 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <ostream>
|
||||
|
||||
#include "jwt/base64.hpp"
|
||||
#include "jwt/algorithm.hpp"
|
||||
#include "jwt/string_view.hpp"
|
||||
#include "jwt/detail/meta.hpp"
|
||||
#include "jwt/json/json.hpp"
|
||||
|
@ -342,6 +343,37 @@ private:
|
|||
*/
|
||||
struct jwt_signature
|
||||
{
|
||||
public: // 'tors
|
||||
/// Default constructor
|
||||
jwt_signature() = default;
|
||||
|
||||
/*!
|
||||
*/
|
||||
jwt_signature(string_view key)
|
||||
: key_(key.data(), key.length())
|
||||
{
|
||||
}
|
||||
|
||||
/// Default copy and assignment operator
|
||||
jwt_signature(const jwt_signature&) = default;
|
||||
jwt_signature& operator=(const jwt_signature&) = default;
|
||||
|
||||
~jwt_signature() = default;
|
||||
|
||||
public: // Exposed APIs
|
||||
/*!
|
||||
*/
|
||||
std::string encode(const jwt_header& header,
|
||||
const jwt_payload& payload);
|
||||
|
||||
private: // Private implementation
|
||||
/*!
|
||||
*/
|
||||
sign_func_t get_algorithm_impl(const jwt_header& hdr) const noexcept;
|
||||
|
||||
private: // Data members;
|
||||
/// The key for creating the JWS
|
||||
std::string key_;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue