2525
2626#include " iceberg/catalog/rest/auth/auth_session.h"
2727#include " iceberg/catalog/rest/iceberg_rest_export.h"
28+ #include " iceberg/result.h"
2829#include " iceberg/table_identifier.h"
2930
3031// / \file iceberg/catalog/rest/auth/auth_manager.h
@@ -58,12 +59,12 @@ class ICEBERG_REST_EXPORT AuthManager {
5859 // / The provided HTTP client is a short-lived client; it should only be used
5960 // / to fetch initial credentials if required, and must be discarded after that.
6061 // /
61- // / This method cannot return null. By default, it returns the catalog session.
62+ // / By default, it returns the catalog session.
6263 // /
6364 // / \param init_client A short-lived HTTP client for initialization.
6465 // / \param properties Configuration properties.
65- // / \return A session for initialization, or the catalog session by default .
66- virtual std::shared_ptr<AuthSession> InitSession (
66+ // / \return A session for initialization, or an error if session creation fails .
67+ virtual Result< std::shared_ptr<AuthSession> > InitSession (
6768 HttpClient* init_client,
6869 const std::unordered_map<std::string, std::string>& properties);
6970
@@ -78,15 +79,14 @@ class ICEBERG_REST_EXPORT AuthManager {
7879 // / (e.g., for renewing or refreshing credentials). It is not necessary to
7980 // / close it when Close() is called.
8081 // /
81- // / This method cannot return null.
82- // /
8382 // / It is not required to cache the returned session internally, as the catalog
8483 // / will keep it alive for the lifetime of the catalog.
8584 // /
8685 // / \param shared_client A long-lived, shared HTTP client.
8786 // / \param properties Configuration properties (merged with server config).
88- // / \return A session for catalog operations.
89- virtual std::shared_ptr<AuthSession> CatalogSession (
87+ // / \return A session for catalog operations, or an error if session creation fails
88+ // / (e.g., missing required credentials, network failure during token fetch).
89+ virtual Result<std::shared_ptr<AuthSession>> CatalogSession (
9090 HttpClient* shared_client,
9191 const std::unordered_map<std::string, std::string>& properties) = 0;
9292
@@ -96,7 +96,7 @@ class ICEBERG_REST_EXPORT AuthManager {
9696 // / this method should return a new AuthSession instance. Otherwise, it should
9797 // / return the parent session.
9898 // /
99- // / This method cannot return null. By default, it returns the parent session.
99+ // / By default, it returns the parent session.
100100 // /
101101 // / Implementors should cache table sessions internally, as the catalog will not
102102 // / cache them. Also, the owning catalog never closes table sessions; implementations
@@ -105,8 +105,8 @@ class ICEBERG_REST_EXPORT AuthManager {
105105 // / \param table The table identifier.
106106 // / \param properties Properties returned by the table/view endpoint.
107107 // / \param parent The parent session (typically the catalog session).
108- // / \return A session for the table, or the parent session by default .
109- virtual std::shared_ptr<AuthSession> TableSession (
108+ // / \return A session for the table, or an error if session creation fails .
109+ virtual Result< std::shared_ptr<AuthSession> > TableSession (
110110 const TableIdentifier& table,
111111 const std::unordered_map<std::string, std::string>& properties,
112112 std::shared_ptr<AuthSession> parent);
0 commit comments