Class PasswordProtectedAdapterCargo

All Implemented Interfaces:
ExtensionPoint, Describable<ContainerAdapter>, Serializable
Direct Known Subclasses:
GlassFishAdapter, JBossAdapter, TomcatAdapter, WebLogicAdapter

public abstract class PasswordProtectedAdapterCargo extends DefaultCargoContainerAdapterImpl
Creates credentials for the previously stored password. Historical precedent of the multiple password fields and why they should not be removed. Using Tomcat7xAdapter as an example, but applies to all. v1.0 Stored password as plain text

              <Tomcat7xAdapter>
                  <userName>admin</userName>
                  <password>pw</password>
                  <url>http://example.com:8080</url>
              </Tomcat7xAdapter>
          
v1.9 Used Scrambler to base64 encode password. readResolve converted plaintext password to passwordScrambled.

              <Tomcat7xAdapter>
                  <userName>admin</userName>
                  <passwordScrambled>cHcNCg==</passwordScrambled>
                  <url>http://example.com:8080</url>
              </Tomcat7xAdapter>
          
v1.11 Full support of credentials. To be backwards compatible and not break builds converts old configurations from password or passwordScrambled to credentials.

              <Tomcat7xAdapter>
                  <credentialsId>aDjnKd4j-s66fnF53-2dmAS7PkqD4</credentialsId>
                  <url>http://example.com:8080</url>
              </Tomcat7xAdapter>
          
Author:
Alex Johnson, Kohsuke Kawaguchi
See Also:
  • Constructor Details

    • PasswordProtectedAdapterCargo

      public PasswordProtectedAdapterCargo(String credentialsId)
    • PasswordProtectedAdapterCargo

      @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @Deprecated public PasswordProtectedAdapterCargo(String userName, String password)
      Deprecated.
  • Method Details

    • redeployFile

      public void redeployFile(FilePath war, String aContextPath, Run<?,?> run, Launcher launcher, TaskListener listener) throws IOException, InterruptedException
      Description copied from class: CargoContainerAdapter
      Perform redeployment. If failed, return false. Implementations should override me and make ContainerAdapter.redeploy(FilePath, String, AbstractBuild, Launcher, BuildListener) delegate to that implementation to be usable within Pipeline projects
      Overrides:
      redeployFile in class CargoContainerAdapter
      Parameters:
      war - the path of the war/ear file to deploy
      aContextPath - the context path for the war to be deployed
      run - the build that is being deployed
      launcher - the launcher of the build
      listener - the BuildListener of the build to deploy
      Throws:
      IOException - if there is an error locating the war file
      InterruptedException - if there is an error deploying to the server
    • loadCredentials

      public void loadCredentials(Job<?,?> job)
      Loads the credentials for a job.
      Parameters:
      job - the job to lookup the scope for
    • getCredentialsId

      public String getCredentialsId()
    • getUsername

      @Property("cargo.remote.username") public String getUsername()
    • getPassword

      @Property("cargo.remote.password") @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getPassword()
    • getUrl

      public String getUrl()
    • migrateCredentials

      public boolean migrateCredentials(List<com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials> generated)
      Migrates to credentials. In case where migration fails, we retain the original username/password/passwordScrambled fields and should avoid saving to disk until the user can help resolve the situation.
      Parameters:
      generated - generated credentials which should be checked
      Returns:
      True if migration succeeded, false if we tried to create credentials and failed.