Class JsonServiceAccountConfig

  • All Implemented Interfaces:
    Describable<ServiceAccountConfig>, Serializable

    public class JsonServiceAccountConfig
    extends ServiceAccountConfig
    Provides authentication mechanism for a service account by setting a JSON private key file. The JSON file structure needs to be:

    { "private_key":"-----BEGIN PRIVATE KEY-----\n ... \n-----END PRIVATE KEY-----\n", "client_email":"...@developer.gserviceaccount.com", ... }

    See Also:
    Serialized Form
    • Constructor Detail

      • JsonServiceAccountConfig

        @DataBoundConstructor
        public JsonServiceAccountConfig()
        Since:
        0.8
      • JsonServiceAccountConfig

        @Deprecated
        public JsonServiceAccountConfig​(org.apache.commons.fileupload.FileItem jsonKeyFile,
                                        String prevJsonKeyFile)
        Deprecated.
        For being able to load credentials created with versions < 0.8 and backwards compatibility with external callers.
        Parameters:
        jsonKeyFile - The uploaded JSON key file.
        prevJsonKeyFile - The path of the previous JSON key file.
        Since:
        0.3
    • Method Detail

      • setJsonKeyFileUpload

        @DataBoundSetter
        public void setJsonKeyFileUpload​(org.apache.commons.fileupload.FileItem jsonKeyFileUpload)
        Parameters:
        jsonKeyFileUpload - The uploaded JSON key file.
      • setFilename

        @DataBoundSetter
        public void setFilename​(String filename)
        Parameters:
        filename - The JSON key file name.
      • setSecretJsonKey

        @DataBoundSetter
        public void setSecretJsonKey​(com.cloudbees.plugins.credentials.SecretBytes secretJsonKey)
        Parameters:
        secretJsonKey - The JSON key file content.
      • getFilename

        @CheckForNull
        public String getFilename()
        Returns:
        Original uploaded file name.
        Since:
        0.7
      • getSecretJsonKey

        @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class)
        @CheckForNull
        public com.cloudbees.plugins.credentials.SecretBytes getSecretJsonKey()
      • getJsonKeyFileUpload

        @Deprecated
        @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class)
        public org.apache.commons.fileupload.FileItem getJsonKeyFileUpload()
        Deprecated.
        For use in UI, do not use.
        Returns:
        The uploaded JSON key file.
      • getAccountId

        public String getAccountId()
        In this context the service account id is represented by the email address for that service account, which should be contained in the JSON key.
        Specified by:
        getAccountId in class ServiceAccountConfig
        Returns:
        The service account identifier. Null if no JSON key has been provided.