Class GoogleCredentialsConfiguration

  • All Implemented Interfaces:
    io.micronaut.core.util.Toggleable

    @ConfigurationProperties("gcp.credentials")
    @Context
    public class GoogleCredentialsConfiguration
    extends java.lang.Object
    implements io.micronaut.core.util.Toggleable
    Configuration for the Google credentials.
    Since:
    1.0
    Author:
    graemerocher, Ray Tsang
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean DEFAULT_ENABLED
      Google credentials configuration is enabled by default.
      static java.util.List<java.net.URI> DEFAULT_SCOPES
      The default scopes.
      static java.lang.String PREFIX
      The prefix to use.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<java.lang.String> getEncodedKey()
      The Base64 encoded service account key content.
      java.util.Optional<java.lang.String> getLocation()
      The location of the service account credential key file.
      java.util.List<java.net.URI> getScopes()
      The scopes to use.
      boolean isEnabled()
      Returns whether Google credentials configuration is enabled or not.
      void setEnabled​(boolean enabled)
      Allows disabling Google credentials configuration.
      void setEncodedKey​(java.lang.String encodedKey)
      Sets the Base64 encoded service account key content..
      void setLocation​(java.lang.String location)
      Sets the location to the service account credential key file.
      void setScopes​(java.util.List<java.net.URI> scopes)
      The default scopes to associate with the application to access specific APIs.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GoogleCredentialsConfiguration

        public GoogleCredentialsConfiguration()
    • Method Detail

      • getScopes

        @NonNull
        public java.util.List<java.net.URI> getScopes()
        The scopes to use.
        Returns:
        The scopes
      • setScopes

        public void setScopes​(@Nullable
                              java.util.List<java.net.URI> scopes)
        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

        @NonNull
        public java.util.Optional<java.lang.String> 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

        public void setLocation​(@Nullable
                                java.lang.String location)
        Sets the location to the service account credential key file.
        Parameters:
        location - The location
      • getEncodedKey

        @NonNull
        public java.util.Optional<java.lang.String> 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, configure
        location
        instead.
        Returns:
        The key
      • setEncodedKey

        public void setEncodedKey​(@Nullable
                                  java.lang.String encodedKey)
        Sets the Base64 encoded service account key content..
        Parameters:
        encodedKey - The key
      • isEnabled

        public boolean isEnabled()
        Returns whether Google credentials configuration is enabled or not.
        Specified by:
        isEnabled in interface io.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