@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class JSONLogFieldSyntax extends LogFieldSyntax<JSONObject>
{ "redacted":"{REDACTED}" }
. If a JSON
object is completely tokenized, then the tokenized representation will be
{ "tokenized":"{TOKENIZED:token-value}" }
", where token-value
will be replaced with a generated value.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only
supported for use against Ping Identity, UnboundID, and
Nokia/Alcatel-Lucent 8661 server products. These classes provide support
for proprietary functionality or for external specifications that are not
considered stable or mature enough to be guaranteed to work in an
interoperable way with other types of LDAP servers.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SYNTAX_NAME
The name for this syntax.
|
CARRIAGE_RETURN_CODE_POINT, DOUBLE_QUOTE_CODE_POINT, NEWLINE_CODE_POINT, OCTOTHORPE_CODE_POINT, REDACTED_STRING, TAB_CODE_POINT, TOKEN_PREFIX_STRING, TOKEN_SUFFIX_STRING
Constructor and Description |
---|
JSONLogFieldSyntax(int maxStringLengthCharacters,
java.util.Collection<java.lang.String> includedSensitiveFields,
java.util.Collection<java.lang.String> excludedSensitiveFields)
Creates a new JSON log field syntax instance that can optionally define
specific fields to include in or exclude from redaction or tokenization.
|
Modifier and Type | Method and Description |
---|---|
boolean |
completelyRedactedValueConformsToSyntax()
Indicates whether values that have been completely redacted still conform
to this syntax.
|
boolean |
completelyTokenizedValueConformsToSyntax()
Indicates whether values that have been completely tokenized still conform
to this syntax.
|
java.util.Set<java.lang.String> |
getExcludedSensitiveFields()
Retrieves the names of the JSON fields whose values should not be
considered sensitive and should not have their values redacted or tokenized
by methods that operate on value components.
|
java.util.Set<java.lang.String> |
getIncludedSensitiveFields()
Retrieves the names of the JSON fields whose values should be considered
sensitive and should have their values redacted or tokenized by methods
that operate on value components.
|
java.lang.String |
getSyntaxName()
Retrieves the name for this syntax.
|
void |
logCompletelyRedactedFieldToJSONFormattedLog(java.lang.String fieldName,
JSONBuffer buffer)
Appends a completely redacted representation of the specified field (both
field name and value) for a JSON-formatted log message to the given buffer.
|
void |
logCompletelyRedactedFieldToTextFormattedLog(java.lang.String fieldName,
ByteStringBuffer buffer)
Appends a completely redacted representation of the specified field (both
field name and value) for a text-formatted log message to the given buffer.
|
void |
logCompletelyRedactedValueToJSONFormattedLog(JSONBuffer buffer)
Appends a completely redacted representation of a value (without a field
name, as might be suitable for a value included in a JSON array) for a
JSON-formatted log message to the given buffer.
|
void |
logCompletelyTokenizedFieldToJSONFormattedLog(java.lang.String fieldName,
JSONObject fieldValue,
byte[] pepper,
JSONBuffer buffer)
Appends a completely tokenized representation of the specified field (both
field name and value) for a JSON-formatted log message to the given buffer.
|
void |
logCompletelyTokenizedFieldToTextFormattedLog(java.lang.String fieldName,
JSONObject fieldValue,
byte[] pepper,
ByteStringBuffer buffer)
Appends a completely tokenized representation of the specified field (both
field name and value) for a text-formatted log message to the given buffer.
|
void |
logCompletelyTokenizedValueToJSONFormattedLog(JSONObject value,
byte[] pepper,
JSONBuffer buffer)
Appends a completely tokenized representation of the provided value
(without a field name, as might be suitable for a value included in a JSON
array) for a JSON-formatted log message to the given buffer.
|
void |
logRedactedComponentsFieldToJSONFormattedLog(java.lang.String fieldName,
JSONObject fieldValue,
JSONBuffer buffer)
Appends a representation of the specified field (both field name and value)
with redacted value components for a JSON-formatted log message to the
given buffer.
|
void |
logRedactedComponentsFieldToTextFormattedLog(java.lang.String fieldName,
JSONObject fieldValue,
ByteStringBuffer buffer)
Appends a representation of the specified field (both field name and value)
with redacted value components for a text-formatted log message to the
given buffer.
|
void |
logRedactedComponentsValueToJSONFormattedLog(JSONObject value,
JSONBuffer buffer)
Appends a representation of the provided value (without a field name, as
might be suitable for a value included in a JSON array) with redacted
components for a JSON-formatted log message to the given buffer.
|
void |
logSanitizedFieldToJSONFormattedLog(java.lang.String fieldName,
JSONObject fieldValue,
JSONBuffer buffer)
Appends a sanitized representation of the specified field (both field name
and value) for a JSON-formatted log message to the given buffer.
|
void |
logSanitizedFieldToTextFormattedLog(java.lang.String fieldName,
JSONObject fieldValue,
ByteStringBuffer buffer)
Appends a sanitized representation of the specified field (both field name
and value) for a text-formatted log message to the given buffer.
|
void |
logSanitizedValueToJSONFormattedLog(JSONObject value,
JSONBuffer buffer)
Appends a sanitized representation of the provided value (without a field
name, as might be suitable for a value included in a JSON array) for a
JSON-formatted log message to the given buffer.
|
void |
logTokenizedComponentsFieldToJSONFormattedLog(java.lang.String fieldName,
JSONObject fieldValue,
byte[] pepper,
JSONBuffer buffer)
Appends a representation of the specified field (both field name and value)
with tokenized value components for a JSON-formatted log message to the
given buffer.
|
void |
logTokenizedComponentsFieldToTextFormattedLog(java.lang.String fieldName,
JSONObject fieldValue,
byte[] pepper,
ByteStringBuffer buffer)
Appends a representation of the specified field (both field name and value)
with tokenized value components for a text-formatted log message to the
given buffer.
|
void |
logTokenizedComponentsValueToJSONFormattedLog(JSONObject value,
byte[] pepper,
JSONBuffer buffer)
Appends a representation of the provided value (without a field name, as
might be suitable for a value included in a JSON array) with tokenized
value components for a JSON-formatted log message to the given buffer.
|
JSONObject |
parseValue(java.lang.String valueString)
Attempts to parse the provided string as a value in accordance with this
syntax.
|
void |
redactComponents(JSONObject value,
ByteStringBuffer buffer)
Appends a string representation of the given value with redacted components
to the provided buffer.
|
void |
redactEntireValue(ByteStringBuffer buffer)
Appends a string representation of a redacted entire value to the provided
buffer.
|
boolean |
supportsRedactedComponents()
Indicates whether this syntax supports redacting individual components of
the entire value.
|
boolean |
supportsTokenizedComponents()
Indicates whether this syntax supports tokenizing individual components of
the entire value.
|
void |
tokenizeComponents(JSONObject value,
byte[] pepper,
ByteStringBuffer buffer)
Appends a string representation of the given value with zero or more of its
components tokenized to the provided buffer.
|
void |
tokenizeEntireValue(JSONObject value,
byte[] pepper,
ByteStringBuffer buffer)
Appends a tokenized representation of the provided value to the given
buffer.
|
boolean |
valueStringIsCompletelyRedacted(java.lang.String valueString)
Determines whether the provided value string represents a value that has
been completely redacted.
|
boolean |
valueStringIsCompletelyTokenized(java.lang.String valueString)
Determines whether the provided value string represents a value that has
been completely tokenized.
|
void |
valueToSanitizedString(JSONObject value,
ByteStringBuffer buffer)
Encodes the provided value to a sanitized string representation suitable
for inclusion in a log message.
|
boolean |
valueWithRedactedComponentsConformsToSyntax()
Indicates whether values with one or more redacted components still conform
to this syntax.
|
boolean |
valueWithTokenizedComponentsConformsToSyntax()
Indicates whether values with one or more tokenized components still
conform to this syntax.
|
getMaxStringLengthCharacters, getTemporaryBuffer, redactComponents, redactEntireValue, releaseTemporaryBuffer, sanitize, sanitize, sha256, tokenize, tokenize, tokenize, tokenizeComponents, tokenizeEntireValue, valueStringIncludesRedactedComponent, valueStringIncludesTokenizedComponent, valueToSanitizedString
@NotNull public static final java.lang.String SYNTAX_NAME
public JSONLogFieldSyntax(int maxStringLengthCharacters, @Nullable java.util.Collection<java.lang.String> includedSensitiveFields, @Nullable java.util.Collection<java.lang.String> excludedSensitiveFields)
maxStringLengthCharacters
- The maximum length (in characters) to
use for strings within values. Strings
that are longer than this should be
truncated before inclusion in the log.
This value must be greater than or equal
to zero.includedSensitiveFields
- The names for the JSON fields whose
values should be considered sensitive
and should have their values redacted or
tokenized by methods that operate on
value components. This may be
null
or empty if no included
sensitive fields should be defined.excludedSensitiveFields
- The names for the specific fields whose
values should not be considered
sensitive and should not have their
values redacted or tokenized by methods
that operate on value components. This
may be null
or empty if no
excluded sensitive fields should be
defined.@NotNull public java.util.Set<java.lang.String> getIncludedSensitiveFields()
@NotNull public java.util.Set<java.lang.String> getExcludedSensitiveFields()
@NotNull public java.lang.String getSyntaxName()
getSyntaxName
in class LogFieldSyntax<JSONObject>
public void valueToSanitizedString(@NotNull JSONObject value, @NotNull ByteStringBuffer buffer)
valueToSanitizedString
in class LogFieldSyntax<JSONObject>
value
- The value to be encoded. It must not be null
.buffer
- The buffer to which the string representation should be
appended. It must not be null
.public void logSanitizedFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONObject fieldValue, @NotNull ByteStringBuffer buffer)
logSanitizedFieldToTextFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.fieldValue
- The value to use for the field. It must not be
null
.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logSanitizedFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONObject fieldValue, @NotNull JSONBuffer buffer)
logSanitizedFieldToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.fieldValue
- The value to use for the field. It must not be
null
.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logSanitizedValueToJSONFormattedLog(@NotNull JSONObject value, @NotNull JSONBuffer buffer)
logSanitizedValueToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
value
- The value to be appended to the buffer. It must not be
null
.buffer
- The buffer to which the sanitized value should be appended.
It must not be null
.@NotNull public JSONObject parseValue(@NotNull java.lang.String valueString) throws RedactedValueException, TokenizedValueException, LogSyntaxException
parseValue
in class LogFieldSyntax<JSONObject>
valueString
- The string to be parsed.RedactedValueException
- If the provided value has been redacted
(either the complete value or one or more
of its components), and the redacted form
cannot be represented in this syntax.TokenizedValueException
- If the provided value has been tokenized
(either the complete value or one or more
of its components), and the redacted form
cannot be represented in this syntax.LogSyntaxException
- If the provided value cannot be parsed in
accordance with this syntax.public boolean valueStringIsCompletelyRedacted(@NotNull java.lang.String valueString)
valueStringIsCompletelyRedacted
in class LogFieldSyntax<JSONObject>
valueString
- The value for which to make the determination. It
must not be null
.true
if the provided value string represents a value that
has been completely redacted, or false
if not.public boolean completelyRedactedValueConformsToSyntax()
completelyRedactedValueConformsToSyntax
in class LogFieldSyntax<JSONObject>
true
if values that have been completely redacted still
conform to this syntax, or false
if not.public void redactEntireValue(@NotNull ByteStringBuffer buffer)
redactEntireValue
in class LogFieldSyntax<JSONObject>
buffer
- The buffer to which the redacted string representation
should be appended. It must not be null
.public void logCompletelyRedactedFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull ByteStringBuffer buffer)
logCompletelyRedactedFieldToTextFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logCompletelyRedactedFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONBuffer buffer)
logCompletelyRedactedFieldToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logCompletelyRedactedValueToJSONFormattedLog(@NotNull JSONBuffer buffer)
logCompletelyRedactedValueToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
buffer
- The buffer to which the redacted value should be appended.
It must not be null
.public boolean supportsRedactedComponents()
supportsRedactedComponents
in class LogFieldSyntax<JSONObject>
true
if this syntax supports redacting individual
components of the entire value, or false
if not.public boolean valueWithRedactedComponentsConformsToSyntax()
valueWithRedactedComponentsConformsToSyntax
in class LogFieldSyntax<JSONObject>
true
if values with one or more redacted components still
conform to this syntax.public void redactComponents(@NotNull JSONObject value, @NotNull ByteStringBuffer buffer)
redactComponents
in class LogFieldSyntax<JSONObject>
value
- The value for which to obtain the redacted representation.
It must not be null
.buffer
- The buffer to which the redacted string representation
should be appended. It must not be null
.public void logRedactedComponentsFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONObject fieldValue, @NotNull ByteStringBuffer buffer)
logRedactedComponentsFieldToTextFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.fieldValue
- The value to use for the field. It must not be
null
.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logRedactedComponentsFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONObject fieldValue, @NotNull JSONBuffer buffer)
logRedactedComponentsFieldToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.fieldValue
- The value to use for the field. It must not be
null
.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logRedactedComponentsValueToJSONFormattedLog(@NotNull JSONObject value, @NotNull JSONBuffer buffer)
logRedactedComponentsValueToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
value
- The value to be appended to the buffer in redacted form.
It must not be null
.buffer
- The buffer to which the redacted value should be appended.
It must not be null
.public boolean valueStringIsCompletelyTokenized(@NotNull java.lang.String valueString)
valueStringIsCompletelyTokenized
in class LogFieldSyntax<JSONObject>
valueString
- The value for which to make the determination. It
must not be null
.true
if the provided value string represents a value that
has been completely tokenized, or false
if not.public boolean completelyTokenizedValueConformsToSyntax()
completelyTokenizedValueConformsToSyntax
in class LogFieldSyntax<JSONObject>
true
if values that have been completely tokenized still
conform to this syntax, or false
if not.public void tokenizeEntireValue(@NotNull JSONObject value, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
tokenizeEntireValue
in class LogFieldSyntax<JSONObject>
value
- The value for which to generate the token. It must not be
null
.pepper
- A pepper used to provide brute-force protection for the
resulting token. The pepper value should be kept secret so
that it is not available to unauthorized users who might be
able to view log information, although the same pepper
value should be consistently provided when tokenizing
values so that the same value will consistently yield the
same token. It must not be null
and should not be
empty.buffer
- The buffer to which the tokenized representation should be
appended. It must not be null
.public void logCompletelyTokenizedFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONObject fieldValue, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
logCompletelyTokenizedFieldToTextFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.fieldValue
- The value to use for the field. It must not be
null
.pepper
- A pepper used to provide brute-force protection for the
resulting token. The pepper value should be kept
secret so that it is not available to unauthorized
users who might be able to view log information,
although the same pepper value should be consistently
provided when tokenizing values so that the same value
will consistently yield the same token. It must not be
null
and should not be empty.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logCompletelyTokenizedFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONObject fieldValue, @NotNull byte[] pepper, @NotNull JSONBuffer buffer)
logCompletelyTokenizedFieldToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.fieldValue
- The value to use for the field. It must not be
null
.pepper
- A pepper used to provide brute-force protection for the
resulting token. The pepper value should be kept
secret so that it is not available to unauthorized
users who might be able to view log information,
although the same pepper value should be consistently
provided when tokenizing values so that the same value
will consistently yield the same token. It must not be
null
and should not be empty.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logCompletelyTokenizedValueToJSONFormattedLog(@NotNull JSONObject value, @NotNull byte[] pepper, @NotNull JSONBuffer buffer)
logCompletelyTokenizedValueToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
value
- The value to be appended to the buffer in tokenized form.
It must not be null
.pepper
- A pepper used to provide brute-force protection for the
resulting token. The pepper value should be kept secret so
that it is not available to unauthorized users who might be
able to view log information, although the same pepper
value should be consistently provided when tokenizing
values so that the same value will consistently yield the
same token. It must not be null
and should not be
empty.buffer
- The buffer to which the tokenized value should be appended.
It must not be null
.public boolean supportsTokenizedComponents()
supportsTokenizedComponents
in class LogFieldSyntax<JSONObject>
true
if this syntax supports tokenizing individual
components of the entire value, or false
if not.public boolean valueWithTokenizedComponentsConformsToSyntax()
valueWithTokenizedComponentsConformsToSyntax
in class LogFieldSyntax<JSONObject>
true
if values with one or more tokenized components still
conform to this syntax.public void tokenizeComponents(@NotNull JSONObject value, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
tokenizeComponents
in class LogFieldSyntax<JSONObject>
value
- The value whose components should be tokenized. It must
not be null
.pepper
- A pepper used to provide brute-force protection for the
resulting token. The pepper value should be kept secret so
that it is not available to unauthorized users who might be
able to view log information, although the same pepper
value should be consistently provided when tokenizing
values so that the same value will consistently yield the
same token. It must not be null
and should not be
empty.buffer
- The buffer to which the tokenized representation should be
appended. It must not be null
.public void logTokenizedComponentsFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONObject fieldValue, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
logTokenizedComponentsFieldToTextFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.fieldValue
- The value to use for the field. It must not be
null
.pepper
- A pepper used to provide brute-force protection for the
resulting token. The pepper value should be kept
secret so that it is not available to unauthorized
users who might be able to view log information,
although the same pepper value should be consistently
provided when tokenizing values so that the same value
will consistently yield the same token. It must not be
null
and should not be empty.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logTokenizedComponentsFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull JSONObject fieldValue, @NotNull byte[] pepper, @NotNull JSONBuffer buffer)
logTokenizedComponentsFieldToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
fieldName
- The name for the field. It must not be null
.fieldValue
- The value to use for the field. It must not be
null
.pepper
- A pepper used to provide brute-force protection for the
resulting token. The pepper value should be kept
secret so that it is not available to unauthorized
users who might be able to view log information,
although the same pepper value should be consistently
provided when tokenizing values so that the same value
will consistently yield the same token. It must not be
null
and should not be empty.buffer
- The buffer to which the sanitized log field should be
appended. It must not be null
.public void logTokenizedComponentsValueToJSONFormattedLog(@NotNull JSONObject value, @NotNull byte[] pepper, @NotNull JSONBuffer buffer)
logTokenizedComponentsValueToJSONFormattedLog
in class LogFieldSyntax<JSONObject>
value
- The value to be appended to the buffer in tokenized form.
It must not be null
.pepper
- A pepper used to provide brute-force protection for the
resulting token. The pepper value should be kept secret so
that it is not available to unauthorized users who might be
able to view log information, although the same pepper
value should be consistently provided when tokenizing
values so that the same value will consistently yield the
same token. It must not be null
and should not be
empty.buffer
- The buffer to which the tokenized value should be appended.
It must not be null
.