Class Sanitizer
java.lang.Object
org.springframework.boot.actuate.endpoint.Sanitizer
Strategy that should be used by endpoint implementations to sanitize potentially
sensitive keys.
- Since:
- 2.0.0
- Author:
- Christian Dupuis, Toshiaki Maki, Phillip Webb, Nicolas Lejeune, Stephane Nicoll, HaiTao Zhang, Chris Bono, David Good, Madhura Bhave
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newSanitizerinstance with a default set of keys to sanitize.Sanitizer(Iterable<SanitizingFunction> sanitizingFunctions) Create a newSanitizerinstance with a default set of keys to sanitize and additional sanitizing functions.Sanitizer(Iterable<SanitizingFunction> sanitizingFunctions, String... keysToSanitize) Create a newSanitizerinstance with specific keys to sanitize and additional sanitizing functions.Create a newSanitizerinstance with specific keys to sanitize. -
Method Summary
Modifier and TypeMethodDescriptionvoidkeysToSanitize(String... keysToSanitize) Adds keys that should be sanitized.Sanitize the given value if necessary.sanitize(SanitizableData data) Sanitize the value from the givenSanitizableDatausing the availableSanitizingFunctions.voidsetKeysToSanitize(String... keysToSanitize) Set the keys that should be sanitized, overwriting any existing configuration.
-
Constructor Details
-
Sanitizer
public Sanitizer()Create a newSanitizerinstance with a default set of keys to sanitize. -
Sanitizer
Create a newSanitizerinstance with specific keys to sanitize.- Parameters:
keysToSanitize- the keys to sanitize
-
Sanitizer
Create a newSanitizerinstance with a default set of keys to sanitize and additional sanitizing functions.- Parameters:
sanitizingFunctions- the sanitizing functions to apply- Since:
- 2.6.0
-
Sanitizer
Create a newSanitizerinstance with specific keys to sanitize and additional sanitizing functions.- Parameters:
sanitizingFunctions- the sanitizing functions to applykeysToSanitize- the keys to sanitize- Since:
- 2.6.0
-
-
Method Details
-
setKeysToSanitize
Set the keys that should be sanitized, overwriting any existing configuration. Keys can be simple strings that the property ends with or regular expressions.- Parameters:
keysToSanitize- the keys to sanitize
-
keysToSanitize
Adds keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions.- Parameters:
keysToSanitize- the keys to sanitize- Since:
- 2.5.0
-
sanitize
Sanitize the given value if necessary.- Parameters:
key- the key to sanitizevalue- the value- Returns:
- the potentially sanitized value
-
sanitize
Sanitize the value from the givenSanitizableDatausing the availableSanitizingFunctions.- Parameters:
data- the sanitizable data- Returns:
- the potentially updated data
- Since:
- 2.6.0
-