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
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Descriptor for JSON service account authentication.Nested classes/interfaces inherited from class com.google.jenkins.plugins.credentials.oauth.ServiceAccountConfig
ServiceAccountConfig.Descriptor
-
Constructor Summary
ConstructorsConstructorDescriptionJsonServiceAccountConfig
(org.apache.commons.fileupload.FileItem jsonKeyFile, String prevJsonKeyFile) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionIn this context the service account id is represented by the email address for that service account, which should be contained in the JSON key.Deprecated.org.apache.commons.fileupload.FileItem
Deprecated.com.cloudbees.plugins.credentials.SecretBytes
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 Details
-
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 Details
-
setJsonKeyFileUpload
@DataBoundSetter public void setJsonKeyFileUpload(org.apache.commons.fileupload.FileItem jsonKeyFileUpload) - Parameters:
jsonKeyFileUpload
- The uploaded JSON key file.
-
setFilename
- 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
-
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. -
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
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
- 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.
-