1#ifndef SOURCEMETA_CORE_OAUTH_ERROR_H_
2#define SOURCEMETA_CORE_OAUTH_ERROR_H_
4#ifndef SOURCEMETA_CORE_OAUTH_EXPORT
5#include <sourcemeta/core/oauth_export.h>
8#include <sourcemeta/core/error.h>
9#include <sourcemeta/core/http.h>
15namespace sourcemeta::core {
133SOURCEMETA_CORE_OAUTH_EXPORT
149SOURCEMETA_CORE_OAUTH_EXPORT
164SOURCEMETA_CORE_OAUTH_EXPORT
180SOURCEMETA_CORE_OAUTH_EXPORT
195SOURCEMETA_CORE_OAUTH_EXPORT
197 -> std::optional<OAuthAuthorizationError>;
209SOURCEMETA_CORE_OAUTH_EXPORT
211 -> std::optional<OAuthTokenError>;
223SOURCEMETA_CORE_OAUTH_EXPORT
225 -> std::optional<OAuthBearerError>;
238SOURCEMETA_CORE_OAUTH_EXPORT
240 -> std::optional<OAuthRegistrationError>;
260SOURCEMETA_CORE_OAUTH_EXPORT
262 const bool authenticated_via_header)
noexcept
279SOURCEMETA_CORE_OAUTH_EXPORT
283SOURCEMETA_CORE_ERROR_WARNINGS_PUSH
288class SOURCEMETA_CORE_OAUTH_EXPORT OAuthMetadataParseError :
public Error {
290 OAuthMetadataParseError() noexcept
291 :
Error{
"The input is not a valid OAuth metadata document"} {}
297class SOURCEMETA_CORE_OAUTH_EXPORT OAuthRegistrationParseError :
public Error {
299 OAuthRegistrationParseError() noexcept
300 :
Error{
"The input is not a valid OAuth client registration document"} {}
303SOURCEMETA_CORE_ERROR_WARNINGS_POP
Error(const StaticString message) noexcept
Construct the error given its message.
Definition error_base.h:84
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