Class MaskPasswordsConfig
java.lang.Object
com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsConfig
Singleton class to manage Mask Passwords global settings.
- Since:
- 2.5
- Author:
- Romain Seguy (http://openromain.blogspot.com)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addGlobalVarMaskRegex
(MaskPasswordsBuildWrapper.VarMaskRegex varMaskRegex) Adds a regex at the global level.void
addGlobalVarMaskRegex
(String name, MaskPasswordsBuildWrapper.VarMaskRegex varMaskRegex) void
addGlobalVarMaskRegex
(String name, String regex) void
addGlobalVarPasswordPair
(MaskPasswordsBuildWrapper.VarPasswordPair varPasswordPair) Adds a key/password pair at the global level.void
addMaskedPasswordParameterDefinition
(String className) void
clear()
void
clear
(boolean doSave) Deprecated.Returns the list of regexes defined at the global level.Returns the list of key/password pairs defined at the global level.static MaskPasswordsConfig
Returns a map of allParameterDefinition
s that can be used in jobs.boolean
Returns whether the plugin is enabled globally for ALL BUILDS.boolean
isMasked
(ParameterValue value, String paramValueClassName) Returns true if the specified parameter value class key corresponds to a parameter definition class key selected in Jenkins' main configuration screen.boolean
Deprecated.There is a high risk of false-negatives.boolean
isSelected
(String paramDefClassName) Returns true if the specified parameter definition class key has been selected in Jenkins main configuration screen.static MaskPasswordsConfig
load()
void
removeGlobalVarMaskRegex
(String name, String regex) void
final void
reset()
Resets configuration to the default state.static void
save
(MaskPasswordsConfig config) void
setGlobalVarEnabledGlobally
(boolean state) toString()
-
Field Details
-
globalVarMaskRegexes
Deprecated.Users can define regexes at the global level to mask in jobs.Never ever use this attribute directly: Use
getGlobalVarMaskRegexesMap()
to avoid potential NPEs.- Since:
- 2.9 Deprecated in favor of globalVarMaskRegexesMap which has label names mapped to value's for better identification
-
globalVarMaskRegexesU
-
globalVarMaskRegexesMap
-
-
Constructor Details
-
MaskPasswordsConfig
public MaskPasswordsConfig()
-
-
Method Details
-
addGlobalVarPasswordPair
Adds a key/password pair at the global level.If either key or password is blank (as defined per the Commons Lang library), then the pair is not added.
- Since:
- 2.7
-
addGlobalVarMaskRegex
Adds a regex at the global level.If regex is blank (as defined per the Commons Lang library), then the pair is not added.
- Since:
- 2.9
-
addGlobalVarMaskRegex
-
addGlobalVarMaskRegex
-
removeGlobalVarMaskRegexByName
-
removeGlobalVarMaskRegex
-
addMaskedPasswordParameterDefinition
- Parameters:
className
- The class key of aParameterDefinition.ParameterDescriptor
to be added to the list of parameters which will prevent the rebuild action to be enabled for a build
-
setGlobalVarEnabledGlobally
public void setGlobalVarEnabledGlobally(boolean state) -
reset
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final void reset()Resets configuration to the default state. -
clear
public void clear() -
clear
public void clear(boolean doSave) -
getInstance
-
getGlobalVarPasswordPairs
Returns the list of key/password pairs defined at the global level.Modifications broughts to the returned list has no impact on this configuration (the returned value is a copy). Also, the list can be empty but never
null
.- Since:
- 2.7
-
getGlobalVarMaskRegexesU
Returns the list of regexes defined at the global level.Modifications broughts to the returned list has no impact on this configuration (the returned value is a copy). Also, the list can be empty but never
null
.- Since:
- 2.9
-
getGlobalVarMaskRegexesList
Deprecated.Fixes JENKINS-11514: WhenMaskPasswordsConfig.xml
is there but was created from version 2.8 (or older) of the plugin,globalVarPasswordPairs
can actually benull
==> Always use this getter to avoid NPEs.- Since:
- 2.9
-
getGlobalVarMaskRegexesUList
-
getGlobalVarMaskRegexesMap
-
getParameterDefinitions
Returns a map of allParameterDefinition
s that can be used in jobs.The key is the class key of the
ParameterDefinition
, the value is its display key. -
isEnabledGlobally
public boolean isEnabledGlobally()Returns whether the plugin is enabled globally for ALL BUILDS. -
isMasked
Deprecated.There is a high risk of false-negatives. UseisMasked(hudson.model.ParameterValue, java.lang.String)
at leastCheck if the parameter value class needs to be masked- Parameters:
paramValueClassName
- Class key of theParameterValue
- Returns:
true
if the parameter value should be masked.false
if the plugin is not sure, may be false-negative
-
isMasked
Returns true if the specified parameter value class key corresponds to a parameter definition class key selected in Jenkins' main configuration screen.- Parameters:
value
- Parameter value. Without it there is a high risk of false negatives.paramValueClassName
- Class key of theParameterValue
class implementation- Returns:
true
if the parameter value should be masked.false
if the plugin is not sure, may be false-negative especially if the value isnull
.- Since:
- 2.10
-
isSelected
Returns true if the specified parameter definition class key has been selected in Jenkins main configuration screen. -
load
-
save
- Throws:
IOException
-
toString
-