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
ConstructorDescriptionCreate a newSanitizer
instance with a default set of keys to sanitize.Sanitizer
(Iterable<SanitizingFunction> sanitizingFunctions) Create a newSanitizer
instance with a default set of keys to sanitize and additional sanitizing functions.Sanitizer
(Iterable<SanitizingFunction> sanitizingFunctions, String... keysToSanitize) Create a newSanitizer
instance with specific keys to sanitize and additional sanitizing functions.Create a newSanitizer
instance with specific keys to sanitize. -
Method Summary
Modifier and TypeMethodDescriptionvoid
keysToSanitize
(String... keysToSanitize) Adds keys that should be sanitized.Sanitize the given value if necessary.sanitize
(SanitizableData data) Sanitize the value from the givenSanitizableData
using the availableSanitizingFunction
s.void
setKeysToSanitize
(String... keysToSanitize) Set the keys that should be sanitized, overwriting any existing configuration.
-
Constructor Details
-
Sanitizer
public Sanitizer()Create a newSanitizer
instance with a default set of keys to sanitize. -
Sanitizer
Create a newSanitizer
instance with specific keys to sanitize.- Parameters:
keysToSanitize
- the keys to sanitize
-
Sanitizer
Create a newSanitizer
instance 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 newSanitizer
instance 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 givenSanitizableData
using the availableSanitizingFunction
s.- Parameters:
data
- the sanitizable data- Returns:
- the potentially updated data
- Since:
- 2.6.0
-