Class CredentialsHelper
java.lang.Object
org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
fillAuthentication
(String mavenSettingsContent, Boolean isReplaceAllServerDefinitions, Map<String, com.cloudbees.plugins.credentials.common.StandardUsernameCredentials> mavenServerId2jenkinsCredential, FilePath workDir, List<String> tempFiles) resolveCredentials
(Run<?, ?> build, List<ServerCredentialMapping> serverCredentialMappings) Deprecated.resolveCredentials
(Run<?, ?> build, List<ServerCredentialMapping> serverCredentialMappings, TaskListener listener) Resolves the given serverCredential mappings and returns a map paring serverId to credentialsecretsForMasking
(Run<?, ?> build, List<ServerCredentialMapping> propertiesCredentialMappings)
-
Method Details
-
resolveCredentials
public static Map<String,com.cloudbees.plugins.credentials.common.StandardUsernameCredentials> resolveCredentials(Run<?, ?> build, List<ServerCredentialMapping> serverCredentialMappings, TaskListener listener) Resolves the given serverCredential mappings and returns a map paring serverId to credential- Parameters:
build
- authentication scopeserverCredentialMappings
- the mappings to be resolvedlistener
- the listener- Returns:
- map of serverId - credential
-
resolveCredentials
@Deprecated public static Map<String,com.cloudbees.plugins.credentials.common.StandardUsernameCredentials> resolveCredentials(Run<?, ?> build, List<ServerCredentialMapping> serverCredentialMappings) Deprecated. -
fillAuthentication
public static String fillAuthentication(String mavenSettingsContent, Boolean isReplaceAllServerDefinitions, Map<String, com.cloudbees.plugins.credentials.common.StandardUsernameCredentials> mavenServerId2jenkinsCredential, FilePath workDir, List<String> tempFiles) throws Exception- Parameters:
mavenSettingsContent
- Maven settings.xml (must be valid XML)mavenServerId2jenkinsCredential
- the credentials to be inserted into the XML (key: Maven serverId, value: Jenkins credentials)isReplaceAllServerDefinitions
- overwrite all the<server>
declarations. Iffalse
, only the<server>
with anid
matching the givenmavenServerId2jenkinsCredential
are overwritten.workDir
- folder in which credentials files are created if needed (private key files...)tempFiles
- temp files created by this method, these files MUST be deleted by the caller- Returns:
- the updated version of the
mavenSettingsContent
with the server credentials added - Throws:
Exception
-
secretsForMasking
@NonNull public static List<String> secretsForMasking(Run<?, ?> build, List<ServerCredentialMapping> propertiesCredentialMappings)
-