Class 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:
    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 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
    • 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 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 Detail

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