mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 18:07:14 +01:00
4a6bfc086c
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
//
|
|
// Serializer.h
|
|
//
|
|
// Library: JWT
|
|
// Package: JWT
|
|
// Module: Serializer
|
|
//
|
|
// Definition of the Serializer class.
|
|
//
|
|
// Copyright (c) 2019, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#ifndef JWT_Serializer_INCLUDED
|
|
#define JWT_Serializer_INCLUDED
|
|
|
|
|
|
#include "Poco/JWT/JWT.h"
|
|
#include "Poco/JSON/Object.h"
|
|
|
|
|
|
namespace Poco {
|
|
namespace JWT {
|
|
|
|
|
|
class JWT_API Serializer
|
|
/// A helper class for serializing and deserializing JWTs.
|
|
{
|
|
public:
|
|
static std::string serialize(const Poco::JSON::Object& object);
|
|
/// Serializes and base64-encodes a JSON object.
|
|
|
|
static void serialize(const Poco::JSON::Object& object, std::ostream& stream);
|
|
/// Serializes and base64-encodes a JSON object.
|
|
|
|
static Poco::JSON::Object::Ptr deserialize(const std::string& serialized);
|
|
/// Attempts to deserialize a base64-encoded serialized JSON object.
|
|
|
|
static Poco::JSON::Object::Ptr deserialize(std::istream& stream);
|
|
/// Attempts to deserialize a base64-encoded serialized JSON object.
|
|
|
|
static std::vector<std::string> split(const std::string& token);
|
|
/// Splits a serialized JWT into its components.
|
|
};
|
|
|
|
|
|
} } // namespace Poco::JWT
|
|
|
|
|
|
#endif // JWT_Serializer_INCLUDED
|