Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
oauth_bearer.h
1#ifndef SOURCEMETA_CORE_OAUTH_BEARER_H_
2#define SOURCEMETA_CORE_OAUTH_BEARER_H_
3
4#ifndef SOURCEMETA_CORE_OAUTH_EXPORT
5#include <sourcemeta/core/oauth_export.h>
6#endif
7
8#include <sourcemeta/core/json.h>
9
10#include <cstdint> // std::uint8_t
11#include <optional> // std::optional
12#include <string> // std::string
13#include <string_view> // std::string_view
14
15namespace sourcemeta::core {
16
32SOURCEMETA_CORE_OAUTH_EXPORT
33auto oauth_bearer_header(const std::string_view token, std::string &sink)
34 -> bool;
35
54SOURCEMETA_CORE_OAUTH_EXPORT
55auto oauth_challenge_parameter(const std::string_view header,
56 const std::string_view scheme,
57 const std::string_view name)
58 -> std::optional<std::string>;
59
67 std::string_view realm;
69 std::string_view scope;
71 std::string_view error;
73 std::string_view error_description;
75 std::string_view error_uri;
78 std::string_view resource_metadata;
81 std::string_view algs;
82};
83
112SOURCEMETA_CORE_OAUTH_EXPORT
113auto oauth_build_challenge(const std::string_view scheme,
114 const OAuthChallenge &challenge, std::string &sink)
115 -> bool;
116
136SOURCEMETA_CORE_OAUTH_EXPORT
137auto oauth_has_audience(const JSON &claims, const std::string_view audience)
138 -> bool;
139
158SOURCEMETA_CORE_OAUTH_EXPORT
159auto oauth_has_scope(const JSON &claims, const std::string_view value) -> bool;
160
163enum class OAuthScopeDecision : std::uint8_t {
172};
173
213SOURCEMETA_CORE_OAUTH_EXPORT
214auto oauth_scope_request_accepts(const JSON &claims, const JSON &request)
216
236SOURCEMETA_CORE_OAUTH_EXPORT
237auto oauth_is_dpop_bound(const JSON &claims) -> bool;
238
239} // namespace sourcemeta::core
240
241#endif
Definition json_value.h:39
std::string_view error_description
The human-readable error description (RFC 6750 Section 3).
Definition oauth_bearer.h:73
std::string_view error_uri
The URI of a human-readable error page (RFC 6750 Section 3).
Definition oauth_bearer.h:75
std::string_view error
The error code (RFC 6750 Section 3.1).
Definition oauth_bearer.h:71
std::string_view algs
Definition oauth_bearer.h:81
std::string_view scope
The space-delimited scope the token must carry (RFC 6750 Section 3).
Definition oauth_bearer.h:69
std::string_view resource_metadata
Definition oauth_bearer.h:78
std::string_view realm
The protection space the credentials apply to (RFC 6750 Section 3).
Definition oauth_bearer.h:67
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_has_scope(const JSON &claims, const std::string_view value) -> bool
OAuthScopeDecision
Definition oauth_bearer.h:163
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_build_challenge(const std::string_view scheme, const OAuthChallenge &challenge, std::string &sink) -> bool
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_bearer_header(const std::string_view token, std::string &sink) -> bool
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_is_dpop_bound(const JSON &claims) -> bool
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_scope_request_accepts(const JSON &claims, const JSON &request) -> OAuthScopeDecision
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_challenge_parameter(const std::string_view header, const std::string_view scheme, const std::string_view name) -> std::optional< std::string >
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_has_audience(const JSON &claims, const std::string_view audience) -> bool
@ Accepted
The granted scope satisfies the rule.
Definition oauth_bearer.h:165
@ Unreadable
Definition oauth_bearer.h:171
@ Refused
Definition oauth_bearer.h:168
Definition oauth_bearer.h:65