Class CredentialsAuth
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<Auth2>
-
- io.jenkins.plugins.remote.result.trigger.auth2.Auth2
-
- io.jenkins.plugins.remote.result.trigger.auth2.CredentialsAuth
-
- All Implemented Interfaces:
Describable<Auth2>
,Serializable
,Cloneable
public class CredentialsAuth extends Auth2
- Author:
- HW
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CredentialsAuth.CredentialsAuthDescriptor
-
Nested classes/interfaces inherited from class io.jenkins.plugins.remote.result.trigger.auth2.Auth2
Auth2.Auth2Descriptor
-
-
Field Summary
Fields Modifier and Type Field Description static Auth2.Auth2Descriptor
DESCRIPTOR
-
Constructor Summary
Constructors Constructor Description CredentialsAuth()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getCredentials(Item item)
Get JenkinsClient CredentialsString
getCredentialsId()
Auth2.Auth2Descriptor
getDescriptor()
String
getPassword(Item item)
Tries to find the Jenkins Credential and returns the password.String
getUserName(Item item)
Tries to find the Jenkins Credential and returns the user name.int
hashCode()
void
setCredentialsId(String credentialsId)
String
toString()
String
toString(Item item)
Returns a string representing the authorization.
-
-
-
Field Detail
-
DESCRIPTOR
@Extension public static final Auth2.Auth2Descriptor DESCRIPTOR
-
-
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.
-
getCredentials
public String getCredentials(Item item) throws CredentialsNotFoundException
Get JenkinsClient Credentials- Specified by:
getCredentials
in classAuth2
- Parameters:
item
- item- Returns:
- Credentials
- Throws:
CredentialsNotFoundException
-
toString
public String toString(Item item)
Description copied from class:Auth2
Returns a string representing the authorization.- Specified by:
toString
in classAuth2
- 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.
-
getDescriptor
public Auth2.Auth2Descriptor getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<Auth2>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<Auth2>
-
-