Package org.apache.juneau.http
Class RedactedQueryParams
java.lang.Object
org.apache.juneau.http.RedactedQueryParams
Utility for masking the values of query-string parameters that commonly carry secrets (passwords, tokens, API
keys) before a URI is written somewhere observable, such as a log line.
Parameter-name matching is case-insensitive. Only the value is masked; the parameter name and the rest of the URI are preserved.
String
- Since:
- 10.0.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisSensitive(String name) Returnstrueif the given query parameter name is inDEFAULT(case-insensitive).static booleanisSensitive(String name, Collection<String> names) Returnstrueif the given query parameter name matches one ofnames, case-insensitively.static StringMasks the values of sensitive query parameters in a URI usingDEFAULT.static StringredactUri(String uri, Collection<String> names) Masks the values of query parameters whose names matchnamesin a URI.
-
Field Details
-
DEFAULT
Canonical set of query parameter names commonly used to carry secrets, matched case-insensitively.
-
-
Method Details
-
isSensitive
Returnstrueif the given query parameter name is inDEFAULT(case-insensitive).- Parameters:
name- The parameter name to test. Can benull(returnsfalse).- Returns:
trueif the name is sensitive.
-
isSensitive
Returnstrueif the given query parameter name matches one ofnames, case-insensitively.- Parameters:
name- The parameter name to test. Can benull(returnsfalse).names- The candidate names. Can benull(returnsfalse).nullelements are ignored.- Returns:
trueif the name is sensitive.
-
redactUri
Masks the values of sensitive query parameters in a URI usingDEFAULT.- Parameters:
uri- The URI or URI reference. Can benull(returned as-is).- Returns:
- The URI with sensitive parameter values replaced by
RedactedHeaders.REDACTED.
-
redactUri
Masks the values of query parameters whose names matchnamesin a URI.The parameter name is compared after percent-decoding. A fragment, if present, is left untouched.
- Parameters:
uri- The URI or URI reference. Can benull(returned as-is).names- The sensitive parameter names. Can benull(nothing is masked).- Returns:
- The URI with matching parameter values replaced by
RedactedHeaders.REDACTED.
-