Class MaskPasswordsConfig


  • public class MaskPasswordsConfig
    extends Object
    Singleton class to manage Mask Passwords global settings.
    Since:
    2.5
    Author:
    Romain Seguy (http://openromain.blogspot.com)
    • Constructor Detail

      • MaskPasswordsConfig

        public MaskPasswordsConfig()
    • Method Detail

      • addGlobalVarPasswordPair

        public void addGlobalVarPasswordPair​(MaskPasswordsBuildWrapper.VarPasswordPair varPasswordPair)
        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

        public void addGlobalVarMaskRegex​(MaskPasswordsBuildWrapper.VarMaskRegex varMaskRegex)
        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

        public void addGlobalVarMaskRegex​(String name,
                                          String regex)
      • removeGlobalVarMaskRegexByName

        public void removeGlobalVarMaskRegexByName​(@NonNull
                                                   String name)
      • removeGlobalVarMaskRegex

        public void removeGlobalVarMaskRegex​(String name,
                                             String regex)
      • addMaskedPasswordParameterDefinition

        public void addMaskedPasswordParameterDefinition​(String className)
        Parameters:
        className - The class key of a ParameterDefinition.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)
      • getGlobalVarPasswordPairs

        public List<MaskPasswordsBuildWrapper.VarPasswordPair> 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

        public List<MaskPasswordsConfig.VarMaskRegexEntry> 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
      • isEnabledGlobally

        public boolean isEnabledGlobally()
        Returns whether the plugin is enabled globally for ALL BUILDS.
      • isMasked

        @Deprecated
        public boolean isMasked​(@NonNull
                                String paramValueClassName)
        Deprecated.
        There is a high risk of false-negatives. Use isMasked(hudson.model.ParameterValue, java.lang.String) at least
        Check if the parameter value class needs to be masked
        Parameters:
        paramValueClassName - Class key of the ParameterValue
        Returns:
        true if the parameter value should be masked. false if the plugin is not sure, may be false-negative
      • isMasked

        public boolean isMasked​(@CheckForNull
                                ParameterValue value,
                                @NonNull
                                String paramValueClassName)
        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 the ParameterValue 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 is null.
        Since:
        2.10
      • isSelected

        public boolean isSelected​(String paramDefClassName)
        Returns true if the specified parameter definition class key has been selected in Jenkins main configuration screen.