Package org.mockserver.fixture
Class FixtureRedactor
- java.lang.Object
-
- org.mockserver.fixture.FixtureRedactor
-
public class FixtureRedactor extends Object
Masks sensitive data in recorded expectations before they are written to fixture files.Operates on copies: the live event log is never mutated. Header values for a configurable set of header names are replaced with a placeholder ("***REDACTED***").
Default sensitive headers:
Authorization,x-api-key,api-key,Cookie,Set-Cookie,Proxy-Authorization.
-
-
Field Summary
Fields Modifier and Type Field Description static StringREDACTED_PLACEHOLDER
-
Constructor Summary
Constructors Constructor Description FixtureRedactor()Create a redactor with the default sensitive header list.FixtureRedactor(Collection<String> sensitiveHeaders)Create a redactor with a custom sensitive header list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expectation[]redact(Expectation[] expectations)Redact sensitive headers in an array of expectations.
-
-
-
Field Detail
-
REDACTED_PLACEHOLDER
public static final String REDACTED_PLACEHOLDER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FixtureRedactor
public FixtureRedactor()
Create a redactor with the default sensitive header list.
-
FixtureRedactor
public FixtureRedactor(Collection<String> sensitiveHeaders)
Create a redactor with a custom sensitive header list.- Parameters:
sensitiveHeaders- header names to redact (case-insensitive)
-
-
Method Detail
-
redact
public Expectation[] redact(Expectation[] expectations)
Redact sensitive headers in an array of expectations. Returns new Expectation objects; the originals are not modified.- Parameters:
expectations- the expectations to redact- Returns:
- new expectations with sensitive header values replaced
-
-