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
FieldsModifier and TypeFieldDescriptionstatic final booleanGoogle credentials configuration is enabled by default.The default scopes.static final booleanUse transport based onHttpClientby default.static final StringThe prefix to use. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe Base64 encoded service account key content.The location of the service account credential key file.The scopes to use.booleanAllows disabling Google credentials configuration.booleanIf the HttpClient based transport should be used for retrieving authentication tokens.voidsetEnabled(boolean enabled) Allows disabling Google credentials configuration.voidsetEncodedKey(@Nullable String encodedKey) Sets the Base64 encoded service account key content..voidsetLocation(@Nullable String location) Sets the location to the service account credential key file.voidThe default scopes to associate with the application to access specific APIs.voidsetUseHttpClient(boolean useHttpClient) Allows disabling use of theHttpClientbased 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 onHttpClientby 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:
isEnabledin 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
HttpClientshould be used for retrieving authentication tokens. - Since:
- 5.4.0
-
setUseHttpClient
public void setUseHttpClient(boolean useHttpClient) Allows disabling use of theHttpClientbased transport for retrieving authentication tokens. Default value is true.- Parameters:
useHttpClient- Whether theHttpClientshould be used for retrieving authentication tokens.- Since:
- 5.4.0
-