Package io.micronaut.gcp.credentials
Class GoogleCredentialsConfiguration
java.lang.Object
io.micronaut.gcp.credentials.GoogleCredentialsConfiguration
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
@ConfigurationProperties("gcp.credentials")
@Context
public class GoogleCredentialsConfiguration
extends Object
implements io.micronaut.core.util.Toggleable
Configuration for the Google credentials.
- Since:
- 1.0
- Author:
- graemerocher, Ray Tsang
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
Google credentials configuration is enabled by default.The default scopes.static final boolean
Use transport based onHttpClient
by default.static final String
The prefix to use. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe Base64 encoded service account key content.The location of the service account credential key file.The scopes to use.boolean
Allows disabling Google credentials configuration.boolean
If the HttpClient based transport should be used for retrieving authentication tokens.void
setEnabled
(boolean enabled) Allows disabling Google credentials configuration.void
setEncodedKey
(@Nullable String encodedKey) Sets the Base64 encoded service account key content..void
setLocation
(@Nullable String location) Sets the location to the service account credential key file.void
The default scopes to associate with the application to access specific APIs.void
setUseHttpClient
(boolean useHttpClient) Allows disabling use of theHttpClient
based transport for retrieving authentication tokens.
-
Field Details
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLEDGoogle credentials configuration is enabled by default. -
DEFAULT_SCOPES
The default scopes. -
DEFAULT_USE_HTTP_CLIENT
public static final boolean DEFAULT_USE_HTTP_CLIENTUse transport based onHttpClient
by default.- See Also:
-
PREFIX
The prefix to use.- See Also:
-
-
Constructor Details
-
GoogleCredentialsConfiguration
public GoogleCredentialsConfiguration()
-
-
Method Details
-
getScopes
The scopes to use.- Returns:
- The scopes
-
setScopes
The default scopes to associate with the application to access specific APIs. See Google Scopes for a complete list. Leave this empty if you don't need additional API access.- Parameters:
scopes
- The scopes
-
getLocation
The location of the service account credential key file. See Understanding Service Accounts for more information on generating a service account key file.- Returns:
- The location
-
setLocation
Sets the location to the service account credential key file.- Parameters:
location
- The location
-
getEncodedKey
The Base64 encoded service account key content. This is not recommended except if you need to encode service account key via an environmental variable. For other use cases, configurelocation
instead.- Returns:
- The key
-
setEncodedKey
Sets the Base64 encoded service account key content..- Parameters:
encodedKey
- The key
-
isEnabled
public boolean isEnabled()Allows disabling Google credentials configuration. This may be useful in situations where you don't want to authenticate despite having the Google Cloud SDK configured. Default value is true.- Specified by:
isEnabled
in interfaceio.micronaut.core.util.Toggleable
- Since:
- 4.4.1
-
setEnabled
public void setEnabled(boolean enabled) Allows disabling Google credentials configuration. This may be useful in situations where you don't want to authenticate despite having the Google Cloud SDK configured. Default value is true.- Parameters:
enabled
- whether to enable or disable Google credentials configuration.- Since:
- 4.4.1
-
isUseHttpClient
public boolean isUseHttpClient()If the HttpClient based transport should be used for retrieving authentication tokens. Default value is true. Note that if HttpClient is not on the classpath, the GCP SDK's default transport will be used instead.- Returns:
- Whether the
HttpClient
should be used for retrieving authentication tokens. - Since:
- 5.4.0
-
setUseHttpClient
public void setUseHttpClient(boolean useHttpClient) Allows disabling use of theHttpClient
based transport for retrieving authentication tokens. Default value is true.- Parameters:
useHttpClient
- Whether theHttpClient
should be used for retrieving authentication tokens.- Since:
- 5.4.0
-