25#include <unordered_map>
44 inline static const std::string kAuthType =
"rest.auth.type";
45 inline static const std::string kAuthTypeNone =
"none";
46 inline static const std::string kAuthTypeBasic =
"basic";
47 inline static const std::string kAuthTypeOAuth2 =
"oauth2";
48 inline static const std::string kAuthTypeSigV4 =
"sigv4";
52 inline static const std::string kBasicUsername =
"rest.auth.basic.username";
53 inline static const std::string kBasicPassword =
"rest.auth.basic.password";
59 inline static const std::string kSigV4Enabled =
"rest.sigv4-enabled";
60 inline static const std::string kSigV4DelegateAuthType =
61 "rest.auth.sigv4.delegate-auth-type";
66 inline static const std::string kSigV4SigningRegion =
"rest.signing-region";
67 inline static const std::string kSigV4SigningName =
"rest.signing-name";
68 inline static const std::string kSigV4SigningNameDefault =
"execute-api";
69 inline static const std::string kSigV4AccessKeyId =
"rest.access-key-id";
70 inline static const std::string kSigV4SecretAccessKey =
"rest.secret-access-key";
71 inline static const std::string kSigV4SessionToken =
"rest.session-token";
75 inline static Entry<std::string> kToken{
"token",
""};
76 inline static Entry<std::string> kCredential{
"credential",
""};
77 inline static Entry<std::string> kScope{
"scope",
"catalog"};
78 inline static Entry<std::string> kOAuth2ServerUri{
"oauth2-server-uri",
80 inline static Entry<bool> kKeepRefreshed{
"token-refresh-enabled",
true};
81 inline static Entry<bool> kExchangeEnabled{
"token-exchange-enabled",
true};
82 inline static Entry<std::string> kAudience{
"audience",
""};
83 inline static Entry<std::string> kResource{
"resource",
""};
87 inline static const std::string kAccessTokenType =
88 "urn:ietf:params:oauth:token-type:access_token";
89 inline static const std::string kRefreshTokenType =
90 "urn:ietf:params:oauth:token-type:refresh_token";
91 inline static const std::string kIdTokenType =
92 "urn:ietf:params:oauth:token-type:id_token";
93 inline static const std::string kSaml1TokenType =
94 "urn:ietf:params:oauth:token-type:saml1";
95 inline static const std::string kSaml2TokenType =
96 "urn:ietf:params:oauth:token-type:saml2";
97 inline static const std::string kJwtTokenType =
"urn:ietf:params:oauth:token-type:jwt";
101 const std::unordered_map<std::string, std::string>& properties);
104 std::string
token()
const {
return Get(kToken); }
108 std::string
scope()
const {
return Get(kScope); }
117 const std::string&
client_id()
const {
return client_id_; }
125 std::string client_id_;
126 std::string client_secret_;
127 std::string token_type_;
128 std::optional<int64_t> expires_at_millis_;
Authentication properties.
Definition auth_properties.h:37
std::unordered_map< std::string, std::string > optional_oauth_params() const
Build optional OAuth params (audience, resource) from config.
std::string credential() const
Get the raw credential string.
Definition auth_properties.h:106
std::string oauth2_server_uri() const
Get the token endpoint URI.
Definition auth_properties.h:110
bool exchange_enabled() const
Whether token exchange is enabled.
Definition auth_properties.h:114
const std::string & client_secret() const
Parsed client_secret from credential.
Definition auth_properties.h:119
std::string scope() const
Get the OAuth2 scope.
Definition auth_properties.h:108
std::string token() const
Get the bearer token.
Definition auth_properties.h:104
const std::string & client_id() const
Parsed client_id from credential (empty if no colon).
Definition auth_properties.h:117
static Result< AuthProperties > FromProperties(const std::unordered_map< std::string, std::string > &properties)
Build an AuthProperties from a properties map.
bool keep_refreshed() const
Whether token refresh is enabled.
Definition auth_properties.h:112
Provide typed configuration helpers.
Define symbol visibility macros for the REST catalog library.
REST catalog authentication APIs.
Definition auth_manager.h:34
std::expected< T, E > Result
Result alias.
Definition result.h:88
Define Result, Status, and error helpers.