Class JsonServiceAccountConfig
- java.lang.Object
-
- com.google.jenkins.plugins.credentials.oauth.ServiceAccountConfig
-
- com.google.jenkins.plugins.credentials.oauth.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonServiceAccountConfig.DescriptorImpl
Descriptor for JSON service account authentication.-
Nested classes/interfaces inherited from class com.google.jenkins.plugins.credentials.oauth.ServiceAccountConfig
ServiceAccountConfig.Descriptor
-
-
Constructor Summary
Constructors Constructor Description JsonServiceAccountConfig()
JsonServiceAccountConfig(org.apache.commons.fileupload.FileItem jsonKeyFile, String prevJsonKeyFile)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.JsonServiceAccountConfig.DescriptorImpl
getDescriptor()
String
getFilename()
String
getJsonKeyFile()
Deprecated.org.apache.commons.fileupload.FileItem
getJsonKeyFileUpload()
Deprecated.PrivateKey
getPrivateKey()
com.cloudbees.plugins.credentials.SecretBytes
getSecretJsonKey()
void
setFilename(String filename)
void
setJsonKeyFileUpload(org.apache.commons.fileupload.FileItem jsonKeyFileUpload)
void
setSecretJsonKey(com.cloudbees.plugins.credentials.SecretBytes secretJsonKey)
-
Methods inherited from class com.google.jenkins.plugins.credentials.oauth.ServiceAccountConfig
getSecretBytesFromFile
-
-
-
-
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.
-
getDescriptor
public JsonServiceAccountConfig.DescriptorImpl getDescriptor()
-
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()
-
getJsonKeyFile
@Deprecated public String getJsonKeyFile()
Deprecated.
-
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 classServiceAccountConfig
- Returns:
- The service account identifier. Null if no JSON key has been provided.
-
getPrivateKey
public PrivateKey getPrivateKey()
- Specified by:
getPrivateKey
in classServiceAccountConfig
- Returns:
- The
PrivateKey
that comes from the secret JSON key. Null if this service account config contains no key or if the key is malformed.
-
-