public class PathMetadataCleanser extends Object implements KeyCleanser
Work#addToMDC(key, value)
STANDARD is for changing non-standard keys to standard keys Example: test_user_id becomes user_id another_user_id becomes user_id
BANNED is for blacklisting keys Example: id becomes unknown_id
Setup
@Bean
public KeyCleanser keyCleanser() {
return new PathMetadataCleanser(STANDARD_MAP);
}
| Constructor and Description |
|---|
PathMetadataCleanser() |
PathMetadataCleanser(Map<String,String> standardMap)
standardMap keys and values will be converted from CamelCase
to snake_case
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBanned(String key,
String value)
Converts CamelCase to snake_case when adding to bannedMap
|
void |
addStandard(String key,
String value)
Converts CamelCase to snake_case when adding to standardMap
|
String |
cleanse(String key,
String value,
String requestUri) |
void |
setTransformFunction(java.util.function.Function<String,String> function)
Sets the function to transform the key which is executed when
cleanse(String, String, String)
is called |
public String cleanse(String key, String value, String requestUri)
cleanse in interface KeyCleanserpublic void addStandard(String key, String value)
key - the key that you want to replacevalue - the key that you are replacing withpublic void addBanned(String key, String value)
key - the key that you want to restrictvalue - the key that you are replacing withpublic void setTransformFunction(java.util.function.Function<String,String> function)
cleanse(String, String, String)
is calledfunction - The transformation function to convert the keyCopyright © 2019. All rights reserved.