public class PasswordMaskingUtils extends Object
Modifier and Type | Field and Description |
---|---|
static List<String> |
PASSWORD_FIELD_NAMES
List of fields which require masking/encrypting.
|
static String |
PASSWORD_MASK |
static com.google.common.base.Predicate<VariableDefinitionContext> |
SHOULD_VARIABLE_BE_MASKED |
static Pattern |
URL_PASSWORD_PATTERN
Regular expression for replacing passwords in URLs.
|
public static final String PASSWORD_MASK
public static final List<String> PASSWORD_FIELD_NAMES
Notice: updating this list will require re-encrypting of some data stored in Bamboo (e.g. variables and shared credentials).
public static final Pattern URL_PASSWORD_PATTERN
public static com.google.common.base.Predicate<VariableDefinitionContext> SHOULD_VARIABLE_BE_MASKED
public static boolean isMasked(@Nullable String value)
public static boolean shouldBeMasked(@Nullable String variableName)
public static boolean shouldBeMasked(@NotNull VariableDefinition variableDefinition)
public static boolean shouldBeMasked(@NotNull VariableDefinitionContext variableDefinition)
public static boolean shouldBeMasked(@NotNull VariableSubstitutionContext variableSubstitutionContext)
public static <T extends VariableDefinitionContext> Collection<? extends T> maskPasswordValues(@NotNull Collection<T> variables, @NotNull com.google.common.base.Function<? super T,? extends T> clone)
public static String mask(@NotNull String string, @Nullable String password)
string
- to find and replace the password inpassword
- to find in the given stringpublic static String mask(@NotNull String string, @Nullable Iterable<String> passwords)
string
- to find and replace the password inpasswords
- to find in the given stringpublic static Iterable<String> findPossiblePasswordValues(Collection<VariableDefinitionContext> variables)
@Deprecated public static String maskPossiblePasswordValues(String text, Collection<VariableDefinitionContext> variables)
maskPossiblePasswordValues(String, VariableContext)
as it performs betterpublic static String maskPossiblePasswordValues(String text, VariableContext variableContext)
@NotNull public static String maskUrlPassword(@NotNull String url)
http://user:password@example.com
will return http://user:********@example.com
.url
- URL as string@NotNull public static Map<String,VariableDefinitionContext> removePasswordVariables(@NotNull Map<String,VariableDefinitionContext> variables)
@NotNull public static Iterable<String> removePasswordVariables(@NotNull Iterable<String> variables)
@NotNull public static <T extends VariableDefinitionContext> Iterable<T> removePasswordVariableDefinitions(@NotNull Iterable<T> variables)
Copyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.