Class StringLogFieldSyntax
- java.lang.Object
-
- com.unboundid.ldap.sdk.unboundidds.logs.v2.syntax.LogFieldSyntax<java.lang.CharSequence>
-
- com.unboundid.ldap.sdk.unboundidds.logs.v2.syntax.StringLogFieldSyntax
-
@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class StringLogFieldSyntax extends LogFieldSyntax<java.lang.CharSequence>
This class defines a log field syntax for values that are arbitrary strings. This syntax does not support redacting or tokenizing individual components within the strings.
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.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SYNTAX_NAME
The name for this syntax.-
Fields inherited from class com.unboundid.ldap.sdk.unboundidds.logs.v2.syntax.LogFieldSyntax
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 Summary
Constructors Constructor Description StringLogFieldSyntax(int maxStringLengthCharacters)
Creates a new instance of this log field syntax implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.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, java.lang.CharSequence 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, java.lang.CharSequence 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(java.lang.CharSequence 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, java.lang.CharSequence 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, java.lang.CharSequence 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(java.lang.CharSequence 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, java.lang.CharSequence 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, java.lang.CharSequence 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(java.lang.CharSequence 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, java.lang.CharSequence 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, java.lang.CharSequence 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(java.lang.CharSequence 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.java.lang.String
parseValue(java.lang.String valueString)
Attempts to parse the provided string as a value in accordance with this syntax.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
tokenizeEntireValue(java.lang.CharSequence value, byte[] pepper, ByteStringBuffer buffer)
Appends a tokenized representation of the provided value to the given buffer.void
valueToSanitizedString(java.lang.CharSequence 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.-
Methods inherited from class com.unboundid.ldap.sdk.unboundidds.logs.v2.syntax.LogFieldSyntax
getMaxStringLengthCharacters, getTemporaryBuffer, redactComponents, redactComponents, redactEntireValue, redactEntireValue, releaseTemporaryBuffer, sanitize, sanitize, sha256, tokenize, tokenize, tokenize, tokenizeComponents, tokenizeComponents, tokenizeEntireValue, valueStringIncludesRedactedComponent, valueStringIncludesTokenizedComponent, valueStringIsCompletelyRedacted, valueStringIsCompletelyTokenized, valueToSanitizedString
-
-
-
-
Field Detail
-
SYNTAX_NAME
@NotNull public static final java.lang.String SYNTAX_NAME
The name for this syntax.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StringLogFieldSyntax
public StringLogFieldSyntax(int maxStringLengthCharacters)
Creates a new instance of this log field syntax implementation.- Parameters:
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.
-
-
Method Detail
-
getSyntaxName
@NotNull public java.lang.String getSyntaxName()
Retrieves the name for this syntax.- Specified by:
getSyntaxName
in classLogFieldSyntax<java.lang.CharSequence>
- Returns:
- The name for this syntax.
-
valueToSanitizedString
public void valueToSanitizedString(@NotNull java.lang.CharSequence value, @NotNull ByteStringBuffer buffer)
Encodes the provided value to a sanitized string representation suitable for inclusion in a log message. The sanitized string should at least be cleaned of control characters and other non-printable characters, but depending on the syntax, it may clean other characters as well.- Specified by:
valueToSanitizedString
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
value
- The value to be encoded. It must not benull
.buffer
- The buffer to which the string representation should be appended. It must not benull
.
-
logSanitizedFieldToTextFormattedLog
public void logSanitizedFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull java.lang.CharSequence fieldValue, @NotNull 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.- Specified by:
logSanitizedFieldToTextFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.fieldValue
- The value to use for the field. It must not benull
.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logSanitizedFieldToJSONFormattedLog
public void logSanitizedFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull java.lang.CharSequence fieldValue, @NotNull 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.- Specified by:
logSanitizedFieldToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.fieldValue
- The value to use for the field. It must not benull
.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logSanitizedValueToJSONFormattedLog
public void logSanitizedValueToJSONFormattedLog(@NotNull java.lang.CharSequence value, @NotNull 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.- Specified by:
logSanitizedValueToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
value
- The value to be appended to the buffer. It must not benull
.buffer
- The buffer to which the sanitized value should be appended. It must not benull
.
-
parseValue
@NotNull public java.lang.String parseValue(@NotNull java.lang.String valueString)
Attempts to parse the provided string as a value in accordance with this syntax.- Specified by:
parseValue
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
valueString
- The string to be parsed.- Returns:
- The value that was parsed.
-
completelyRedactedValueConformsToSyntax
public boolean completelyRedactedValueConformsToSyntax()
Indicates whether values that have been completely redacted still conform to this syntax.- Specified by:
completelyRedactedValueConformsToSyntax
in classLogFieldSyntax<java.lang.CharSequence>
- Returns:
true
if values that have been completely redacted still conform to this syntax, orfalse
if not.
-
logCompletelyRedactedFieldToTextFormattedLog
public void logCompletelyRedactedFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull 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.- Specified by:
logCompletelyRedactedFieldToTextFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logCompletelyRedactedFieldToJSONFormattedLog
public void logCompletelyRedactedFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull 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.- Specified by:
logCompletelyRedactedFieldToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logCompletelyRedactedValueToJSONFormattedLog
public void logCompletelyRedactedValueToJSONFormattedLog(@NotNull 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.- Specified by:
logCompletelyRedactedValueToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
buffer
- The buffer to which the redacted value should be appended. It must not benull
.
-
supportsRedactedComponents
public boolean supportsRedactedComponents()
Indicates whether this syntax supports redacting individual components of the entire value.- Specified by:
supportsRedactedComponents
in classLogFieldSyntax<java.lang.CharSequence>
- Returns:
true
if this syntax supports redacting individual components of the entire value, orfalse
if not.
-
valueWithRedactedComponentsConformsToSyntax
public boolean valueWithRedactedComponentsConformsToSyntax()
Indicates whether values with one or more redacted components still conform to this syntax.- Specified by:
valueWithRedactedComponentsConformsToSyntax
in classLogFieldSyntax<java.lang.CharSequence>
- Returns:
true
if values with one or more redacted components still conform to this syntax.
-
logRedactedComponentsFieldToTextFormattedLog
public void logRedactedComponentsFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull java.lang.CharSequence fieldValue, @NotNull 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. If this syntax does not support redacting components within a value, then it should redact the entire value.- Specified by:
logRedactedComponentsFieldToTextFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.fieldValue
- The value to use for the field. It must not benull
.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logRedactedComponentsFieldToJSONFormattedLog
public void logRedactedComponentsFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull java.lang.CharSequence fieldValue, @NotNull 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. If this syntax does not support redacting components within a value, then it should redact the entire value.- Specified by:
logRedactedComponentsFieldToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.fieldValue
- The value to use for the field. It must not benull
.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logRedactedComponentsValueToJSONFormattedLog
public void logRedactedComponentsValueToJSONFormattedLog(@NotNull java.lang.CharSequence value, @NotNull 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. If this syntax does not support redacting components within a value, then it should redact the entire value.- Specified by:
logRedactedComponentsValueToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
value
- The value to be appended to the buffer in redacted form. It must not benull
.buffer
- The buffer to which the redacted value should be appended. It must not benull
.
-
completelyTokenizedValueConformsToSyntax
public boolean completelyTokenizedValueConformsToSyntax()
Indicates whether values that have been completely tokenized still conform to this syntax.- Specified by:
completelyTokenizedValueConformsToSyntax
in classLogFieldSyntax<java.lang.CharSequence>
- Returns:
true
if values that have been completely tokenized still conform to this syntax, orfalse
if not.
-
tokenizeEntireValue
public void tokenizeEntireValue(@NotNull java.lang.CharSequence value, @NotNull byte[] pepper, @NotNull ByteStringBuffer buffer)
Appends a tokenized representation of the provided value to the given buffer.
The resulting token will protect the provided value by representing it in a way that makes it at infeasible to determine what the original value was. However, tokenizing the same value with the same pepper should consistently yield the same token value, so that it will be possible to identify the same value across multiple log messages.- Specified by:
tokenizeEntireValue
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
value
- The value for which to generate the token. It must not benull
.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 benull
and should not be empty.buffer
- The buffer to which the tokenized representation should be appended. It must not benull
.
-
logCompletelyTokenizedFieldToTextFormattedLog
public void logCompletelyTokenizedFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull java.lang.CharSequence fieldValue, @NotNull byte[] pepper, @NotNull 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.- Specified by:
logCompletelyTokenizedFieldToTextFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.fieldValue
- The value to use for the field. It must not benull
.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 benull
and should not be empty.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logCompletelyTokenizedFieldToJSONFormattedLog
public void logCompletelyTokenizedFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull java.lang.CharSequence fieldValue, @NotNull byte[] pepper, @NotNull 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.- Specified by:
logCompletelyTokenizedFieldToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.fieldValue
- The value to use for the field. It must not benull
.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 benull
and should not be empty.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logCompletelyTokenizedValueToJSONFormattedLog
public void logCompletelyTokenizedValueToJSONFormattedLog(@NotNull java.lang.CharSequence value, @NotNull byte[] pepper, @NotNull 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.- Specified by:
logCompletelyTokenizedValueToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
value
- The value to be appended to the buffer in tokenized form. It must not benull
.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 benull
and should not be empty.buffer
- The buffer to which the tokenized value should be appended. It must not benull
.
-
supportsTokenizedComponents
public boolean supportsTokenizedComponents()
Indicates whether this syntax supports tokenizing individual components of the entire value.- Specified by:
supportsTokenizedComponents
in classLogFieldSyntax<java.lang.CharSequence>
- Returns:
true
if this syntax supports tokenizing individual components of the entire value, orfalse
if not.
-
valueWithTokenizedComponentsConformsToSyntax
public boolean valueWithTokenizedComponentsConformsToSyntax()
Indicates whether values with one or more tokenized components still conform to this syntax.- Specified by:
valueWithTokenizedComponentsConformsToSyntax
in classLogFieldSyntax<java.lang.CharSequence>
- Returns:
true
if values with one or more tokenized components still conform to this syntax.
-
logTokenizedComponentsFieldToTextFormattedLog
public void logTokenizedComponentsFieldToTextFormattedLog(@NotNull java.lang.String fieldName, @NotNull java.lang.CharSequence fieldValue, @NotNull byte[] pepper, @NotNull 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. If this syntax does not support tokenizing components within a value, then it should tokenize the entire value.- Specified by:
logTokenizedComponentsFieldToTextFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.fieldValue
- The value to use for the field. It must not benull
.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 benull
and should not be empty.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logTokenizedComponentsFieldToJSONFormattedLog
public void logTokenizedComponentsFieldToJSONFormattedLog(@NotNull java.lang.String fieldName, @NotNull java.lang.CharSequence fieldValue, @NotNull byte[] pepper, @NotNull 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. If this syntax does not support tokenizing components within a value, then it should tokenize the entire value.- Specified by:
logTokenizedComponentsFieldToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
fieldName
- The name for the field. It must not benull
.fieldValue
- The value to use for the field. It must not benull
.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 benull
and should not be empty.buffer
- The buffer to which the sanitized log field should be appended. It must not benull
.
-
logTokenizedComponentsValueToJSONFormattedLog
public void logTokenizedComponentsValueToJSONFormattedLog(@NotNull java.lang.CharSequence value, @NotNull byte[] pepper, @NotNull 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. If this syntax does not support tokenizing components within a value, then it should tokenize the entire value.- Specified by:
logTokenizedComponentsValueToJSONFormattedLog
in classLogFieldSyntax<java.lang.CharSequence>
- Parameters:
value
- The value to be appended to the buffer in tokenized form. It must not benull
.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 benull
and should not be empty.buffer
- The buffer to which the tokenized value should be appended. It must not benull
.
-
-