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 of FileCredentials.
Since:
1.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    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

    Nested classes/interfaces inherited from interface com.cloudbees.plugins.credentials.common.IdCredentials

    com.cloudbees.plugins.credentials.common.IdCredentials.Helpers

    Nested classes/interfaces inherited from interface com.cloudbees.plugins.credentials.common.StandardCredentials

    com.cloudbees.plugins.credentials.common.StandardCredentials.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)
  • Method Summary

    Modifier and Type
    Method
    Description
    Obtains the actual content of the secret file as a bytestream.
    Indicates the intended naming of the secret content.
    com.cloudbees.plugins.credentials.SecretBytes
    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

    Methods inherited from interface com.cloudbees.plugins.credentials.Credentials

    forRun, getDescriptor, getScope

    Methods inherited from interface com.cloudbees.plugins.credentials.common.IdCredentials

    getId

    Methods inherited from interface com.cloudbees.plugins.credentials.common.StandardCredentials

    getDescription
  • Constructor Details

    • 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
      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 Details

    • getFileName

      public String getFileName()
      Indicates the intended naming of the secret content. For example, private-keys.zip or keystore.
      Specified by:
      getFileName in interface FileCredentials
      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 interface FileCredentials
      Returns:
      some binary data
      Throws:
      IOException - if the data cannot be loaded