public final class JsonSchema extends Object
Modifier and Type | Class and Description |
---|---|
static class |
JsonSchema.ValidationPolicy
JSON value validation policies.
|
Modifier and Type | Field and Description |
---|---|
static Option<Boolean> |
CASE_SENSITIVE_STRINGS
Matching rule option controlling whether JSON string comparisons should be case-sensitive.
|
static Option<Boolean> |
IGNORE_WHITE_SPACE
Matching rule option controlling whether JSON string comparisons should ignore white-space.
|
static Option<Collection<String>> |
INDEXED_FIELD_PATTERNS
Matching rule option controlling which JSON fields should be indexed by the matching rule.
|
static Option<JsonSchema.ValidationPolicy> |
VALIDATION_POLICY
Schema option controlling syntax validation for JSON based attributes.
|
Modifier and Type | Method and Description |
---|---|
static SchemaBuilder |
addJsonSyntaxesAndMatchingRulesToSchema(SchemaBuilder builder)
Adds the syntaxes and matching rules required by for JSON attribute support to the provided schema builder.
|
static Object |
byteStringToJson(ByteString value)
Parses the provided byte string as a JSON value.
|
static MatchingRule |
getCaseExactJsonIdMatchingRule()
Returns the
jsonMatch matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.5. |
static MatchingRule |
getCaseExactJsonQueryMatchingRule()
Returns the
jsonQueryMatch matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.2. |
static String |
getCaseIgnoreExtensibleJsonOrderingMatchingRule()
Returns the extensible JSON ordering matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.6.
|
static MatchingRule |
getCaseIgnoreJsonIdMatchingRule()
Returns the
jsonMatch matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.4. |
static MatchingRule |
getCaseIgnoreJsonQueryMatchingRule()
Returns the
jsonQueryMatch matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.1. |
static Syntax |
getJsonQuerySyntax()
Returns the JSON Query attribute syntax having the OID 1.3.6.1.4.1.36733.2.1.3.2.
|
static Syntax |
getJsonSyntax()
Returns the JSON attribute syntax having the OID 1.3.6.1.4.1.36733.2.1.3.1.
|
static ByteString |
jsonToByteString(Object value)
Converts a JSON
Object to a ByteString representation. |
static MatchingRuleImpl |
newJsonEqualityMatchingRuleImpl(Collection<JsonPointer> keys,
Options options)
Creates a new custom JSON equality matching rule implementation with the provided matching rule name and
options.
|
static MatchingRuleImpl |
newJsonOrderingMatchingRuleImpl(List<JsonPointer> keys,
Options options)
Creates a new custom JSON ordering matching rule implementation with the provided matching rule name and
options.
|
static MatchingRuleImpl |
newJsonQueryEqualityMatchingRuleImpl(String matchingRuleName,
Options options)
Creates a new custom JSON query equality matching rule implementation with the provided matching rule name and
options.
|
public static final Option<JsonSchema.ValidationPolicy> VALIDATION_POLICY
JsonSchema.ValidationPolicy.STRICT
.public static final Option<Boolean> CASE_SENSITIVE_STRINGS
false
meaning that case will be ignored.
This option must be provided when constructing a JSON matching rule using newJsonQueryEqualityMatchingRuleImpl(java.lang.String, org.forgerock.util.Options)
, and cannot be overridden at the schema level.
public static final Option<Boolean> IGNORE_WHITE_SPACE
true
meaning that leading and trailing white-space will be ignored and
intermediate white-space will be reduced to a single white-space character.
This option must be provided when constructing a JSON matching rule using newJsonQueryEqualityMatchingRuleImpl(java.lang.String, org.forgerock.util.Options)
, and cannot be overridden at the schema level.
public static final Option<Collection<String>> INDEXED_FIELD_PATTERNS
Pattern | Matches | Doesn't match |
---|---|---|
/aaa/bbb/ccc | /aaa/bbb/ccc | /aaa/bbb/ccc/ddd /aaa/bbb/cccc |
/aaa/b*/ccc | /aaa/bbb/ccc /aaa/bxx/ccc | /aaa/xxx/ccc /aaa/bbb |
/aaa/**/ddd | /aaa/ddd /aaa/xxx/yyy/ddd | /aaa/bbb/ccc |
/aaa/** | /aaa /aaa/bbb /aaa/bbb/ccc | /aa |
public static Syntax getJsonSyntax()
VALIDATION_POLICY
schema option to control the degree of syntax
enforcement. By default JSON attributes will support equality matching using the
jsonQueryMatch
matching rule, although this may be overridden
when defining individual attribute types.public static Syntax getJsonQuerySyntax()
query filter
strings as
defined in QueryFilterParser
.public static MatchingRule getCaseIgnoreJsonIdMatchingRule()
jsonMatch
matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.4. This matching
rule will compare the _id member of JSON objects. If the _id member has a string value, the matching
rule will use a case insensitive string comparison, and will ignore white space.jsonMatch
matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.4.public static MatchingRule getCaseExactJsonIdMatchingRule()
jsonMatch
matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.5. This matching
rule will compare the _id member of JSON objects. If the _id member has a string value, the matching
rule will use a case sensitive string comparison, and will ignore white space.public static MatchingRule getCaseIgnoreJsonQueryMatchingRule()
jsonQueryMatch
matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.1. The
matching rule's assertion syntax is a CREST JSON query filter
. This matching
rule will ignore case when comparing JSON strings as well as ignoring white space. In addition, all JSON
fields will be indexed if indexing is enabled.jsonQueryMatch
matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.1.public static MatchingRule getCaseExactJsonQueryMatchingRule()
jsonQueryMatch
matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.2. The
matching rule's assertion syntax is a CREST JSON query filter
. This matching
rule will check the case when comparing JSON strings as well as ignoring ignore white space. In addition,
all JSON fields will be indexed if indexing is enabled.jsonQueryMatch
matching rule having the OID 1.3.6.1.4.1.36733.2.1.4.2.public static String getCaseIgnoreExtensibleJsonOrderingMatchingRule()
The returned string is expected to be concatenated with a colon (:) and the colon (:) separated list of the JSON pointers referencing the entries' fields which must be taken into consideration for the ordering.
public static MatchingRuleImpl newJsonEqualityMatchingRuleImpl(Collection<JsonPointer> keys, Options options)
keys
- The list of JSON fields to use to normalize a JSON object.options
- The options controlling the behavior of the matching rule.CASE_SENSITIVE_STRINGS
,
IGNORE_WHITE_SPACE
public static MatchingRuleImpl newJsonOrderingMatchingRuleImpl(List<JsonPointer> keys, Options options)
keys
- The list of JSON fields to use to normalize a JSON object.options
- The options controlling the behavior of the matching rule.CASE_SENSITIVE_STRINGS
,
IGNORE_WHITE_SPACE
public static MatchingRuleImpl newJsonQueryEqualityMatchingRuleImpl(String matchingRuleName, Options options)
getCaseIgnoreJsonQueryMatchingRule()
.matchingRuleName
- The name of the matching rule. This will be used as the index ID in attribute indexes so it must not
collide with other indexes identifiers.options
- The options controlling the behavior of the matching rule.CASE_SENSITIVE_STRINGS
,
IGNORE_WHITE_SPACE
public static SchemaBuilder addJsonSyntaxesAndMatchingRulesToSchema(SchemaBuilder builder)
builder
- The schema builder to which the schema elements should be added.public static Object byteStringToJson(ByteString value)
LocalizedIllegalArgumentException
.value
- The value to be parsed.JSON
value.LocalizedIllegalArgumentException
- If value
is not valid JSON.public static ByteString jsonToByteString(Object value) throws com.fasterxml.jackson.core.JsonProcessingException
Object
to a ByteString
representation.value
- The JSON object to be converted.ByteString
representation.com.fasterxml.jackson.core.JsonProcessingException
- If conversion failed for some reason.Copyright 2010-2022 ForgeRock AS.