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.
|
Modifier and Type | Method and Description |
---|---|
static Iterable<String> |
findPossiblePasswordValues(Collection<VariableDefinitionContext> variables) |
static String |
getPasswordFromUrl(String url) |
static boolean |
isMasked(String value) |
static String |
mask(String string,
Iterable<String> passwords)
Mask a password portion of a larger string.
|
static String |
mask(String string,
String password)
Mask a password portion of a larger string.
|
static <T extends VariableDefinitionContext> |
maskPasswordValues(Collection<T> variables,
com.google.common.base.Function<? super T,? extends T> clone) |
static String |
maskPossiblePasswordValues(String text,
VariableContext variableContext) |
static String |
maskUrlPassword(String url)
Masks password used in URL.
|
static <T extends VariableDefinitionContext> |
removePasswordVariableDefinitions(Iterable<T> variables) |
static Iterable<String> |
removePasswordVariables(Iterable<String> variables) |
static Map<String,VariableDefinitionContext> |
removePasswordVariables(Map<String,VariableDefinitionContext> variables) |
static boolean |
shouldBeMasked(String variableName) |
static boolean |
shouldBeMasked(VariableDefinition variableDefinition) |
static boolean |
shouldBeMasked(VariableDefinitionContext variableDefinition) |
static boolean |
shouldBeMasked(VariableSubstitutionContext variableSubstitutionContext) |
static boolean |
shouldIgnoreValue(String key,
String value) |
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)
public 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 © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.