Class FileCredentialsImpl
- java.lang.Object
-
- com.cloudbees.plugins.credentials.BaseCredentials
-
- com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
-
- org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl
-
- All Implemented Interfaces:
com.cloudbees.plugins.credentials.common.IdCredentials
,com.cloudbees.plugins.credentials.common.StandardCredentials
,com.cloudbees.plugins.credentials.Credentials
,ExtensionPoint
,Describable<com.cloudbees.plugins.credentials.Credentials>
,Serializable
,FileCredentials
public final class FileCredentialsImpl extends com.cloudbees.plugins.credentials.impl.BaseStandardCredentials implements FileCredentials
Default implementation ofFileCredentials
.- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileCredentialsImpl.DescriptorImpl
Our descriptor.-
Nested classes/interfaces inherited from class com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
com.cloudbees.plugins.credentials.impl.BaseStandardCredentials.BaseStandardCredentialsDescriptor
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Nested classes/interfaces inherited from interface org.jenkinsci.plugins.plaincredentials.FileCredentials
FileCredentials.NameProvider
-
-
Constructor Summary
Constructors Constructor Description FileCredentialsImpl(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String description, String fileName, com.cloudbees.plugins.credentials.SecretBytes secretBytes)
Constructor for everyone besides Stapler.FileCredentialsImpl(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String description, org.apache.commons.fileupload.FileItem file, String fileName, com.cloudbees.plugins.credentials.SecretBytes secretBytes)
Constructor for Stapler form binding.FileCredentialsImpl(com.cloudbees.plugins.credentials.CredentialsScope scope, String id, String description, org.apache.commons.fileupload.FileItem file, String fileName, String data)
Deprecated.useFileCredentialsImpl(CredentialsScope, String, String, FileItem, String, SecretBytes)
for stapler orFileCredentialsImpl(CredentialsScope, String, String, String, SecretBytes)
for programatic instantiation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStream
getContent()
Obtains the actual content of the secret file as a bytestream.String
getFileName()
Indicates the intended naming of the secret content.com.cloudbees.plugins.credentials.SecretBytes
getSecretBytes()
Exposes the encrypted content to jelly.-
Methods inherited from class com.cloudbees.plugins.credentials.impl.BaseStandardCredentials
equals, getDescription, getId, hashCode
-
Methods inherited from class com.cloudbees.plugins.credentials.BaseCredentials
getDescriptor, getScope
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
FileCredentialsImpl
@Deprecated public FileCredentialsImpl(@CheckForNull com.cloudbees.plugins.credentials.CredentialsScope scope, @CheckForNull String id, @CheckForNull String description, @NonNull org.apache.commons.fileupload.FileItem file, @CheckForNull String fileName, @CheckForNull String data) throws IOException
Deprecated.useFileCredentialsImpl(CredentialsScope, String, String, FileItem, String, SecretBytes)
for stapler orFileCredentialsImpl(CredentialsScope, String, String, String, SecretBytes)
for programatic instantiation.Constructor for Stapler form binding.- Parameters:
scope
- the scope of the credentials.id
- the id of the credentials.description
- the description of the credentials.file
- the uploaded file.fileName
- the name of the file.data
- the content of the file.- Throws:
IOException
- when things go wrong.
-
FileCredentialsImpl
@DataBoundConstructor public FileCredentialsImpl(@CheckForNull com.cloudbees.plugins.credentials.CredentialsScope scope, @CheckForNull String id, @CheckForNull String description, @CheckForNull org.apache.commons.fileupload.FileItem file, @CheckForNull String fileName, @CheckForNull com.cloudbees.plugins.credentials.SecretBytes secretBytes) throws IOException
Constructor for Stapler form binding.- Parameters:
scope
- the scope of the credentials.id
- the id of the credentials.description
- the description of the credentials.file
- the uploaded file.fileName
- the name of the file.secretBytes
- the content of the file.- Throws:
IOException
- when things go wrong.
-
FileCredentialsImpl
public FileCredentialsImpl(@CheckForNull com.cloudbees.plugins.credentials.CredentialsScope scope, @CheckForNull String id, @CheckForNull String description, @NonNull String fileName, @NonNull com.cloudbees.plugins.credentials.SecretBytes secretBytes)
Constructor for everyone besides Stapler.- Parameters:
scope
- the scope of the credentials.id
- the id of the credentials.description
- the description of the credentials.fileName
- the name of the file.secretBytes
- the content of the file.- Since:
- 1.3
-
-
Method Detail
-
getFileName
public String getFileName()
Indicates the intended naming of the secret content. For example,private-keys.zip
orkeystore
.- Specified by:
getFileName
in interfaceFileCredentials
- Returns:
- a simple file name (no path separators)
-
getSecretBytes
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public com.cloudbees.plugins.credentials.SecretBytes getSecretBytes()
Exposes the encrypted content to jelly.- Returns:
- the encrypted content.
-
getContent
public InputStream getContent() throws IOException
Obtains the actual content of the secret file as a bytestream.- Specified by:
getContent
in interfaceFileCredentials
- Returns:
- some binary data
- Throws:
IOException
- if the data cannot be loaded
-
-