Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
oauth_par.h
1#ifndef SOURCEMETA_CORE_OAUTH_PAR_H_
2#define SOURCEMETA_CORE_OAUTH_PAR_H_
3
4#ifndef SOURCEMETA_CORE_OAUTH_EXPORT
5#include <sourcemeta/core/oauth_export.h>
6#endif
7
8#include <sourcemeta/core/crypto.h>
9#include <sourcemeta/core/json.h>
10#include <sourcemeta/core/oauth_authorization.h>
11
12#include <chrono> // std::chrono::seconds, std::chrono::system_clock
13#include <functional> // std::function
14#include <optional> // std::optional
15#include <string> // std::string
16#include <string_view> // std::string_view
17
18namespace sourcemeta::core {
19
42SOURCEMETA_CORE_OAUTH_EXPORT
44 SecureString &sink) -> void;
45
66SOURCEMETA_CORE_OAUTH_EXPORT
67auto oauth_build_par_authorization_url(const std::string_view endpoint,
68 const std::string_view client_id,
69 const std::string_view request_uri,
70 std::string &sink) -> void;
71
90class SOURCEMETA_CORE_OAUTH_EXPORT OAuthPARResponse {
91public:
94 explicit OAuthPARResponse(const JSON &data);
95
98 [[nodiscard]] auto request_uri() const -> std::optional<std::string_view>;
101 [[nodiscard]] auto expires_in() const -> std::optional<std::chrono::seconds>;
102
104 [[nodiscard]] auto data() const -> const JSON &;
105
106private:
107 const JSON *data_;
108};
109
130[[nodiscard]] SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_parse_par_request(
131 const std::string_view body, SecureString &storage,
133 const std::function<void(std::string_view, std::string_view)> &on_other)
134 -> bool;
135
149[[nodiscard]] SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_par_request_uri()
150 -> std::string;
151
166[[nodiscard]] SOURCEMETA_CORE_OAUTH_EXPORT auto
167oauth_make_par_response(const std::string_view request_uri,
168 const std::chrono::seconds expires_in)
169 -> std::optional<JSON>;
170
188[[nodiscard]] SOURCEMETA_CORE_OAUTH_EXPORT auto
189oauth_par_dpop_binding(const std::string_view dpop_jkt,
190 const std::optional<std::string_view> proof_thumbprint)
191 -> std::optional<std::string_view>;
192
193} // namespace sourcemeta::core
194
195#endif
Definition crypto_secure.h:162
Definition json_value.h:39
auto request_uri() const -> std::optional< std::string_view >
auto data() const -> const JSON &
The underlying document.
auto expires_in() const -> std::optional< std::chrono::seconds >
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_build_par_authorization_url(const std::string_view endpoint, const std::string_view client_id, const std::string_view request_uri, std::string &sink) -> void
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_parse_par_request(const std::string_view body, SecureString &storage, OAuthAuthorizationRequest &result, const std::function< void(std::string_view, std::string_view)> &on_other) -> bool
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_build_par_request(const OAuthAuthorizationRequest &request, SecureString &sink) -> void
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_par_request_uri() -> std::string
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_par_dpop_binding(const std::string_view dpop_jkt, const std::optional< std::string_view > proof_thumbprint) -> std::optional< std::string_view >
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_make_par_response(const std::string_view request_uri, const std::chrono::seconds expires_in) -> std::optional< JSON >
Definition oauth_authorization.h:58