Package com.zb.mom.ww.mxgateway.client
Class MxGatewaySecrets
java.lang.Object
com.zb.mom.ww.mxgateway.client.MxGatewaySecrets
Helpers for redacting secrets such as gateway API keys from log output.
API keys must never reach logs in plaintext. The methods on this class produce shortened, masked forms safe for diagnostic messages.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringredactApiKey(String apiKey) Redacts the body of an API key, leaving only short prefix and suffix windows so it remains comparable in logs.static StringredactCredentials(String value) Replaces gateway-style credential tokens (themxgw_prefix and anyBearermarker) inside a free-form string with a redaction placeholder.
-
Method Details
-
redactApiKey
Redacts the body of an API key, leaving only short prefix and suffix windows so it remains comparable in logs.- Parameters:
apiKey- the API key to redact, may benullor empty- Returns:
- an empty string for
null/empty input,"<redacted>"for keys eight characters or shorter, or a masked form preserving the leading and trailing four characters
-
redactCredentials
Replaces gateway-style credential tokens (themxgw_prefix and anyBearermarker) inside a free-form string with a redaction placeholder.- Parameters:
value- the string to scrub, may benull- Returns:
- an empty string for
null, the original value when blank, or the value with credential tokens replaced by"<redacted>"
-