@Factory
@Requires(classes=com.google.auth.oauth2.GoogleCredentials.class)
public class GoogleCredentialsFactory
extends java.lang.Object
GoogleCredentials
.Constructor and Description |
---|
GoogleCredentialsFactory(GoogleCredentialsConfiguration configuration)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected com.google.auth.oauth2.GoogleCredentials |
defaultGoogleCredentials()
Method used to return the default
GoogleCredentials and provide it as a bean. |
public GoogleCredentialsFactory(@Nonnull GoogleCredentialsConfiguration configuration)
configuration
- The configuration@Requires(missingBeans=com.google.auth.oauth2.GoogleCredentials.class) @Requires(classes=com.google.auth.oauth2.GoogleCredentials.class) @Primary @Singleton protected com.google.auth.oauth2.GoogleCredentials defaultGoogleCredentials() throws java.io.IOException
GoogleCredentials
and provide it as a bean.
It will determine which credential in the following way:
gcp.credentials.locationis specified, use its location
gcp.credentials.encodedKeyis specified, decode it and use its content
GOOGLE_APPLICATION_CREDENTIALSenvironment variable
gcloud auth application-default logincommand
GoogleCredentials
java.io.IOException
- An exception if an error occurs