iceberg-cpp
Loading...
Searching...
No Matches
Functions | Variables
oauth2_util.h File Reference

OAuth2 token utilities for REST catalog authentication. More...

#include <string>
#include <string_view>
#include <unordered_map>
#include "iceberg/catalog/rest/iceberg_rest_export.h"
#include "iceberg/catalog/rest/type_fwd.h"
#include "iceberg/catalog/rest/types.h"
#include "iceberg/result.h"

Go to the source code of this file.

Functions

Result< OAuthTokenResponseiceberg::rest::auth::FetchToken (HttpClient &client, AuthSession &session, const AuthProperties &properties)
 Fetch an OAuth2 token using the client_credentials grant type.
 
std::unordered_map< std::string, std::string > iceberg::rest::auth::AuthHeaders (const std::string &token)
 Build auth headers from a token string.
 

Variables

constexpr std::string_view iceberg::rest::auth::kAuthorizationHeader = "Authorization"
 
constexpr std::string_view iceberg::rest::auth::kBearerPrefix = "Bearer "
 

Detailed Description

OAuth2 token utilities for REST catalog authentication.

Function Documentation

◆ AuthHeaders()

ICEBERG_REST_EXPORT std::unordered_map< std::string, std::string > iceberg::rest::auth::AuthHeaders ( const std::string &  token)

Build auth headers from a token string.

Parameters
tokenBearer token string (may be empty).
Returns
Headers map with Authorization header if token is non-empty.

◆ FetchToken()

ICEBERG_REST_EXPORT Result< OAuthTokenResponse > iceberg::rest::auth::FetchToken ( HttpClient client,
AuthSession session,
const AuthProperties properties 
)

Fetch an OAuth2 token using the client_credentials grant type.

Parameters
clientHTTP client to use for the request.
sessionAuth session for the request headers.
propertiesAuth configuration containing credential, scope, token endpoint, and optional OAuth params.
Returns
The token response or an error.