Class ServiceAccountKeys
java.lang.Object
io.github.flink.gcp.connector.base.auth.ServiceAccountKeys
Loads the service-account key file a connector is configured with.
Each connector keeps its own entry point, which decides the scopes its clients need and
whether to wrap the result in a gax credentials provider. This class owns what they share: a
null path leaves application-default credentials in effect, and a failure is reported
without the path or the parser's exception (ADR-0174).
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.auth.oauth2.GoogleCredentialsload(String serviceAccountKeyFile, Collection<String> scopes, String product) Loads and scopes a service-account key file, or returnsnullto leave application-default credentials in effect.
-
Method Details
-
load
@Nullable public static com.google.auth.oauth2.GoogleCredentials load(@Nullable String serviceAccountKeyFile, Collection<String> scopes, String product) throws IOException Loads and scopes a service-account key file, or returnsnullto leave application-default credentials in effect.The path and parser failure are deliberately absent from the exception. A path can expose a mounted secret's name, and parser exceptions can echo credential material. The actionable distinction is whether the configured file could be loaded at all.
- Parameters:
serviceAccountKeyFile- the configured key-file path, ornullfor ADCscopes- the OAuth scopes the loaded credentials are restricted toproduct- the product name the failure message carries, such as"Spanner"- Returns:
- scoped service-account credentials, or
nullfor ADC - Throws:
IOException- if the configured file cannot be read as a service-account key
-