OAuth2 token and authentication utilities.
More...
#include <oauth2_util.h>
|
| static Result< OAuthTokenResponse > | FetchToken (HttpClient &client, AuthSession &session, const AuthProperties &properties) |
| | Fetch an OAuth2 token using the client_credentials grant type.
|
| |
| static std::unordered_map< std::string, std::string > | AuthHeaders (const std::string &token) |
| | Build auth headers from a token string.
|
| |
| static Result< OAuthTokenResponse > | ExchangeToken (HttpClient &client, AuthSession &session, const std::unordered_map< std::string, std::string > &extra_headers, const std::string &subject_token, const std::string &subject_token_type, const std::optional< std::string > &actor_token, const std::optional< std::string > &actor_token_type, const std::string &scope, const std::string &oauth2_server_uri, const std::unordered_map< std::string, std::string > &optional_params) |
| | Exchange an OAuth2 token using the RFC 8693 grant type.
|
| |
| static std::optional< int64_t > | ExpiresAtMillis (std::string_view token) |
| | Extract expiration time from a JWT token.
|
| |
OAuth2 token and authentication utilities.
◆ AuthHeaders()
| static std::unordered_map< std::string, std::string > iceberg::rest::auth::OAuth2Util::AuthHeaders |
( |
const std::string & |
token | ) |
|
|
static |
Build auth headers from a token string.
- Parameters
-
| token | Bearer token string (may be empty). |
- Returns
- Headers map with Authorization header if token is non-empty.
◆ ExchangeToken()
| static Result< OAuthTokenResponse > iceberg::rest::auth::OAuth2Util::ExchangeToken |
( |
HttpClient & |
client, |
|
|
AuthSession & |
session, |
|
|
const std::unordered_map< std::string, std::string > & |
extra_headers, |
|
|
const std::string & |
subject_token, |
|
|
const std::string & |
subject_token_type, |
|
|
const std::optional< std::string > & |
actor_token, |
|
|
const std::optional< std::string > & |
actor_token_type, |
|
|
const std::string & |
scope, |
|
|
const std::string & |
oauth2_server_uri, |
|
|
const std::unordered_map< std::string, std::string > & |
optional_params |
|
) |
| |
|
static |
Exchange an OAuth2 token using the RFC 8693 grant type.
- Parameters
-
| client | HTTP client to use for the request. |
| session | Auth session for the request headers. |
| extra_headers | Request headers applied before session authentication. |
| subject_token | Subject token to exchange. |
| subject_token_type | Subject token type. |
| actor_token | Optional actor token. |
| actor_token_type | Optional actor token type. |
| scope | OAuth2 scope. |
| oauth2_server_uri | Token exchange endpoint. |
| optional_params | Optional OAuth parameters. |
- Returns
- The token response or an error.
◆ ExpiresAtMillis()
| static std::optional< int64_t > iceberg::rest::auth::OAuth2Util::ExpiresAtMillis |
( |
std::string_view |
token | ) |
|
|
static |
Extract expiration time from a JWT token.
Decodes the JWT payload (base64url) and reads the "exp" claim. Returns std::nullopt if the token is not a valid JWT or has no "exp" claim.
- Parameters
-
| token | A token string containing three dot-separated JWT segments. |
- Returns
- Expiration time as milliseconds since epoch, or std::nullopt.
◆ FetchToken()
Fetch an OAuth2 token using the client_credentials grant type.
- Parameters
-
| client | HTTP client to use for the request. |
| session | Auth session for the request headers. |
| properties | Auth configuration containing credential, scope, token endpoint, and optional OAuth params. |
- Returns
- The token response or an error.
The documentation for this class was generated from the following file: