- All Implemented Interfaces:
ServiceAttributeValidator
public class FilterModeValueValidator
extends Object
implements ServiceAttributeValidator
Validates Filter Mode property value in Agent Properties. e.g.
com.sun.identity.agents.config.filter.mode
The values in set of properties can be application specific:
-for example [somecontextroot]=J2EE_POLICY or one of other valid values
from NONE, SSO_ONLY, URL_POLICY, J2EE_POLICY, ALL
Can also have *one* global value:
-where value has no brackets or context root key and is just a value
NONE, SSO_ONLY, URL_POLICY, J2EE_POLICY, ALL
-also allow a global value format: "=ALL" or none etc, which includes an
equal sign since in property file style an entry like
com.sun.someprop=ALL would have a value "=ALL"
Does not allow []=ALL or none etc.
Does not allow the characters "[" or "]" inside the brackets since this is
not a likely valid character in a context root name and it helps us avoid
the user error of a typo and we use bracket as a special character in parsing.
Ultimately this regular expression could be stricter since the key inside
of brackets is a context root of a web app [somecontextroot] and context
root values only allow certain value, but since agent code and
other places dont validate for this strictness, this validator should be
close to as loose as rest of code for consistency.
Overall set of values:
-Empty set is not allowed since user must specify something.
-Set can only have *one* global value value of NONE, SSO_ONLY, URL_POLICY,
J2EE_POLICY, ALL so java code checks for repeats.
-Duplicates: The validation logic does not check for duplicates in terms of
the whole value ie [somecontextroot]=ALL being included twice. Since a set
is used to hold the values, and Set add method only adds the specified
element to this set if it is not already present so it will not contain any
duplicates. So no check necessary. The UI may allow a user to enter
duplicates but ultimately they are ignored and not stored as part of
agents config.
Duplicates are exact duplicates, since set does not distinguish between
letter case of a key, so "Key" is a different key from "key". We dont check
for duplicates such as this type of possible case.
However, we do check for exact duplicate context root name within whole
values, so if user inputs [mycontextroot]=ALL and [mycontextroot]=NONE then
both values will be in the set, and this code will detect that
"mycontextroot" is a duplicate so set will be considered invalid.