Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
oauth_error.h
1#ifndef SOURCEMETA_CORE_OAUTH_ERROR_H_
2#define SOURCEMETA_CORE_OAUTH_ERROR_H_
3
4#ifndef SOURCEMETA_CORE_OAUTH_EXPORT
5#include <sourcemeta/core/oauth_export.h>
6#endif
7
8#include <sourcemeta/core/http.h>
9
10#include <cstdint> // std::uint8_t
11#include <exception> // std::exception
12#include <optional> // std::optional
13#include <string_view> // std::string_view
14
15namespace sourcemeta::core {
16
37
84
106
120
133SOURCEMETA_CORE_OAUTH_EXPORT
135 -> std::string_view;
136
149SOURCEMETA_CORE_OAUTH_EXPORT
150auto oauth_error_code(const OAuthTokenError error) noexcept -> std::string_view;
151
164SOURCEMETA_CORE_OAUTH_EXPORT
165auto oauth_error_code(const OAuthBearerError error) noexcept
166 -> std::string_view;
167
180SOURCEMETA_CORE_OAUTH_EXPORT
181auto oauth_error_code(const OAuthRegistrationError error) noexcept
182 -> std::string_view;
183
195SOURCEMETA_CORE_OAUTH_EXPORT
196auto to_oauth_authorization_error(const std::string_view code) noexcept
197 -> std::optional<OAuthAuthorizationError>;
198
209SOURCEMETA_CORE_OAUTH_EXPORT
210auto to_oauth_token_error(const std::string_view code) noexcept
211 -> std::optional<OAuthTokenError>;
212
223SOURCEMETA_CORE_OAUTH_EXPORT
224auto to_oauth_bearer_error(const std::string_view code) noexcept
225 -> std::optional<OAuthBearerError>;
226
238SOURCEMETA_CORE_OAUTH_EXPORT
239auto to_oauth_registration_error(const std::string_view code) noexcept
240 -> std::optional<OAuthRegistrationError>;
241
260SOURCEMETA_CORE_OAUTH_EXPORT
262 const bool authenticated_via_header) noexcept
263 -> HTTPStatus;
264
279SOURCEMETA_CORE_OAUTH_EXPORT
281 -> HTTPStatus;
282
283#if defined(_MSC_VER)
284#pragma warning(disable : 4251 4275)
285#endif
286
290class SOURCEMETA_CORE_OAUTH_EXPORT OAuthMetadataParseError
291 : public std::exception {
292public:
293 [[nodiscard]] auto what() const noexcept -> const char * override {
294 return "The input is not a valid OAuth metadata document";
295 }
296};
297
301class SOURCEMETA_CORE_OAUTH_EXPORT OAuthRegistrationParseError
302 : public std::exception {
303public:
304 [[nodiscard]] auto what() const noexcept -> const char * override {
305 return "The input is not a valid OAuth client registration document";
306 }
307};
308
309#if defined(_MSC_VER)
310#pragma warning(default : 4251 4275)
311#endif
312
313} // namespace sourcemeta::core
314
315#endif
Definition http_status.h:20
Definition oauth_error.h:291
OAuthAuthorizationError
Definition oauth_error.h:20
OAuthRegistrationError
Definition oauth_error.h:110
SOURCEMETA_CORE_OAUTH_EXPORT auto to_oauth_bearer_error(const std::string_view code) noexcept -> std::optional< OAuthBearerError >
SOURCEMETA_CORE_OAUTH_EXPORT auto to_oauth_authorization_error(const std::string_view code) noexcept -> std::optional< OAuthAuthorizationError >
SOURCEMETA_CORE_OAUTH_EXPORT auto to_oauth_registration_error(const std::string_view code) noexcept -> std::optional< OAuthRegistrationError >
OAuthBearerError
Definition oauth_error.h:89
SOURCEMETA_CORE_OAUTH_EXPORT auto to_oauth_token_error(const std::string_view code) noexcept -> std::optional< OAuthTokenError >
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_error_code(const OAuthAuthorizationError error) noexcept -> std::string_view
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_token_error_status(const OAuthTokenError error, const bool authenticated_via_header) noexcept -> HTTPStatus
OAuthTokenError
Definition oauth_error.h:42
SOURCEMETA_CORE_OAUTH_EXPORT auto oauth_bearer_error_status(const OAuthBearerError error) noexcept -> HTTPStatus
@ UnauthorizedClient
The client is not authorized to request a code using this method.
Definition oauth_error.h:25
@ ServerError
The authorization server encountered an unexpected condition.
Definition oauth_error.h:33
@ InvalidScope
The requested scope is invalid, unknown, or malformed.
Definition oauth_error.h:31
@ TemporarilyUnavailable
The authorization server is temporarily unable to handle the request.
Definition oauth_error.h:35
@ AccessDenied
The resource owner or authorization server denied the request.
Definition oauth_error.h:27
@ InvalidRequest
Definition oauth_error.h:23
@ UnsupportedResponseType
The authorization server does not support this response type.
Definition oauth_error.h:29
@ InvalidRedirectURI
A redirect URI in the request is invalid.
Definition oauth_error.h:112
@ UnapprovedSoftwareStatement
The software statement is not approved by the authorization server.
Definition oauth_error.h:118
@ InvalidSoftwareStatement
The software statement is invalid.
Definition oauth_error.h:116
@ InvalidClientMetadata
A field in the client metadata is invalid.
Definition oauth_error.h:114
@ InsufficientScope
Definition oauth_error.h:97
@ InvalidToken
Definition oauth_error.h:94
@ UnsupportedTokenType
Definition oauth_error.h:82
@ SlowDown
Definition oauth_error.h:65
@ InvalidClient
Client authentication failed (RFC 6749 Section 5.2).
Definition oauth_error.h:47
@ ExpiredToken
Definition oauth_error.h:71
@ InvalidTarget
Definition oauth_error.h:74
@ InvalidDPoPProof
The DPoP proof is missing or invalid (RFC 9449 Section 5).
Definition oauth_error.h:76
@ InvalidGrant
Definition oauth_error.h:50
@ UseDPoPNonce
Definition oauth_error.h:79
@ AuthorizationPending
Definition oauth_error.h:62
@ UnsupportedGrantType
Definition oauth_error.h:56