Class MxGatewaySecrets

java.lang.Object
com.zb.mom.ww.mxgateway.client.MxGatewaySecrets

public final class MxGatewaySecrets extends Object
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 Details

    • redactApiKey

      public static String redactApiKey(String apiKey)
      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 be null or 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

      public static String redactCredentials(String value)
      Replaces gateway-style credential tokens (the mxgw_ prefix and any Bearer marker) inside a free-form string with a redaction placeholder.
      Parameters:
      value - the string to scrub, may be null
      Returns:
      an empty string for null, the original value when blank, or the value with credential tokens replaced by "<redacted>"