Class Sanitizer
java.lang.Object
org.springframework.boot.actuate.endpoint.Sanitizer
Borrowed from https://github.com/spring-projects/spring-boot/blob/2.7.x/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java
as Sanitizer in Spring Boot 3 is not backward compatible with the version shipped in Spring Boot 2
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newSanitizerinstance with a default set of keys to sanitize.Sanitizer(Iterable<org.springframework.boot.actuate.endpoint.SanitizingFunction> sanitizingFunctions) Create a newSanitizerinstance with a default set of keys to sanitize and additional sanitizing functions.Sanitizer(Iterable<org.springframework.boot.actuate.endpoint.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(org.springframework.boot.actuate.endpoint.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
public Sanitizer(Iterable<org.springframework.boot.actuate.endpoint.SanitizingFunction> sanitizingFunctions) 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
public Sanitizer(Iterable<org.springframework.boot.actuate.endpoint.SanitizingFunction> sanitizingFunctions, String... keysToSanitize) 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
-