Class CredentialsAuth

    • Constructor Detail

      • CredentialsAuth

        @DataBoundConstructor
        public CredentialsAuth()
    • Method Detail

      • setCredentialsId

        @DataBoundSetter
        public void setCredentialsId​(String credentialsId)
      • getCredentialsId

        public String getCredentialsId()
      • getUserName

        public String getUserName​(Item item)
                           throws CredentialsNotFoundException
        Tries to find the Jenkins Credential and returns the user name.
        Parameters:
        item - the Item (Job, Pipeline,...) we are currently running in. The item is required to also get Credentials which are defined in the items scope and not Jenkins globally. Value can be null, but Credentials e.g. configured on a Folder will not be found in this case, only globally configured Credentials.
        Returns:
        The user name configured in this Credential
        Throws:
        CredentialsNotFoundException - if credential could not be found.
      • getPassword

        public String getPassword​(Item item)
                           throws CredentialsNotFoundException
        Tries to find the Jenkins Credential and returns the password.
        Parameters:
        item - the Item (Job, Pipeline,...) we are currently running in. The item is required to also get Credentials which are defined in the items scope and not Jenkins globally. Value can be null, but Credentials e.g. configured on a Folder will not be found in this case, only globally configured Credentials.
        Returns:
        The password configured in this Credential
        Throws:
        CredentialsNotFoundException - if credential could not be found.
      • toString

        public String toString​(Item item)
        Description copied from class: Auth2
        Returns a string representing the authorization.
        Specified by:
        toString in class Auth2
        Parameters:
        item - the Item (Job, Pipeline,...) we are currently running in. The item is required to also get Credentials which are defined in the items scope and not Jenkins globally. Value can be null, but Credentials e.g. configured on a Folder will not be found in this case, only globally configured Credentials.
        Returns:
        a string representing the authorization.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object