Package org.apache.iceberg.gcp.auth
Class GoogleAuthManager
java.lang.Object
org.apache.iceberg.gcp.auth.GoogleAuthManager
- All Implemented Interfaces:
AutoCloseable
,AuthManager
An authentication manager that uses Google Credentials (typically Application Default
Credentials) to create
GoogleAuthSession
instances.
This manager can be configured with properties such as:
gcp.auth.credentials-path
: Path to a service account JSON key file. If not set, Application Default Credentials will be used.gcp.auth.scopes
: Comma-separated list of OAuth scopes to request. Defaults to "https://www.googleapis.com/auth/cloud-platform".
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncatalogSession
(RESTClient sharedClient, Map<String, String> properties) Returns a long-lived session tied to the catalog's lifecycle.void
close()
Closes the manager.contextualSession
(SessionCatalog.SessionContext context, AuthSession parent) Returns a session for a specific context.initSession
(RESTClient initClient, Map<String, String> properties) Initializes and returns a short-lived session, typically for fetching configuration.name()
tableSession
(TableIdentifier table, Map<String, String> properties, AuthSession parent) Returns a session for a specific table or view.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.iceberg.rest.auth.AuthManager
tableSession
-
Field Details
-
DEFAULT_SCOPES
- See Also:
-
GCP_CREDENTIALS_PATH_PROPERTY
- See Also:
-
GCP_SCOPES_PROPERTY
- See Also:
-
-
Constructor Details
-
GoogleAuthManager
-
-
Method Details
-
name
-
initSession
Initializes and returns a short-lived session, typically for fetching configuration. This implementation reuses the long-lived catalog session logic.- Specified by:
initSession
in interfaceAuthManager
-
catalogSession
Returns a long-lived session tied to the catalog's lifecycle. This session uses Google Application Default Credentials or a specified service account.- Specified by:
catalogSession
in interfaceAuthManager
- Parameters:
sharedClient
- The long-lived RESTClient (not used by this implementation for credential fetching).properties
- Configuration properties for the auth manager.- Returns:
- A
GoogleAuthSession
. - Throws:
UncheckedIOException
- if credential loading fails.
-
contextualSession
Returns a session for a specific context. Defaults to the catalog session. For GCP, tokens are typically not context-specific in this manner.- Specified by:
contextualSession
in interfaceAuthManager
-
tableSession
public AuthSession tableSession(TableIdentifier table, Map<String, String> properties, AuthSession parent) Returns a session for a specific table or view. Defaults to the catalog session.- Specified by:
tableSession
in interfaceAuthManager
-
close
public void close()Closes the manager. This is a no-op for GoogleAuthManager.- Specified by:
close
in interfaceAuthManager
- Specified by:
close
in interfaceAutoCloseable
-