Repository navigation
[#218] Name the element a filter compares as the schema spells the attribute, so a filter in another case finds the entry - #222
Conversation
… name from the XML handler, by the lookup create and update use
…schema spells the attribute, so a filter in another case finds the entry
…the schema of the class searched
… outside the schema, and that containsAllValues on __password__ throws Account a2 gets a <ri:LastName> beside its <ri:lastname>, as update wrote such elements before OpenIdentityPlatform#212, and LastName=S finds nothing. It fails with master's getAttributeName and if createEqualsExpression compares the name as given as well as the schema's. containsAllValuesOnThePasswordInAnotherCaseThrows fails if createContainsAllValuesExpression builds its EqualsFilters under the name as given; until now that mapping had no test.
vharseko
left a comment
There was a problem hiding this comment.
Reviewed at b938289. I found no new issues in the changes.
The filter translator now resolves attribute names using the same exact-first, case-insensitive-fallback lookup as create and update, using the schema of the searched object class. Namespace selection follows the resolved name. The UID special case preserves identifier lookup and the name fallback for classes without UID support, and ConcurrentXMLHandler delegates the new lookup correctly.
The treatment of legacy elements, ambiguous case-pair names, and containsAllValues on password attributes is explicitly documented in the PR description.
Local validation on JDK 21: the Maven reactor package build succeeded; all 418 XML connector unit tests passed, with no failures, errors, or skips. CodeQL passed. The Maven CI matrix was still pending or running when I checked.
Closes #218.
Since #212,
createandupdatename an attribute as the schema spells it: they look the given name up exactly first, then without regard to case. The filter translator still named the element it compares by the filter's spelling, and looked itsicf/riprefix up by that spelling too, exactly. SoLastName=Mcompared$x/ri:LastNameand found nothing, and__name__=a1compared$x/ri:__name__: it found nothing and did not reach theEntryIndex.__uid__=xwas the same.XMLHandler.schemaAttributeName(ObjectClass, String)gives the schema's spelling by the lookupcheckAttributeuses; the two shareschemaAttributeandexactAttributes. For a class or a name the schema does not have, it gives the name as given. It is a default method that returns the name as given, so other implementations keep compiling.XMLHandlerImploverrides it.ConcurrentXMLHandler, the connector's handler, delegates without the lock, asisSupportUiddoes: the schema is set when the handler is made.XMLFilterTranslatorgets a constructor(boolean preferUidOverName, UnaryOperator<String> schemaName), andXMLConnector.createFilterTranslatorpassesname -> handler.schemaAttributeName(objClass, name).getAttributeName, which every expression takes its name from, maps a uid in any case to__UID__without the schema and any other name throughschemaName, then applieselementNameas before. The prefix is looked up from the result, so__name__becomesicf:__NAME__.__UID__whatever the schema spells it: the handler looks entries up by exactly that name (getEntry,EntryIndex), and the framework'sgetObjectfilters by it. Through the schema, an XSD that spells the uid__uid__would turngetObject's filter intori:__uid__. On a class without__UID__in the schema, such as__GROUP__,__uid__=xsearches by__NAME__, as__UID__=xdoes.(boolean)constructor stays. It names attributes as given, apart from the uid.Changes in behaviour
equalTo,startsWith,endsWith,contains, the orderings andcontainsAllValues. Before, it found nothing.__name__=xand__uid__=xgo to the index, as__NAME__=xand__UID__=xdo.LastName=Xno longer matches the stray<ri:LastName>elements thatupdateappended before XML connector: create and update accept an attribute name in another case, then lose its value #212; it compares<ri:lastname>. Reads skip the stray elements, so the framework's filter dropped such matches unlesslastnameheldXas well.containsAllValueson__password__or__current_password__now throwsIllegalArgumentExceptionfor any value, aGuardedStringincluded, as it does on__PASSWORD__and__CURRENT_PASSWORD__, when the class searched has that attribute in its schema. The translator rebuilds each value withtoString()into anEqualsFilterunder the schema's name, andAttributeBuilderaccepts only aGuardedStringunder either name. Before, it comparedri:__password__(ri:__current_password__) and found nothing.Tests
XMLHandlerIndexTests#schemaAttributeNameIsTheSchemasSpelling:LastName,LASTNAMEandlastnamegivelastname, and__name__gives__NAME__.__uid__on__GROUP__and an unknown class give the name as given.new ConcurrentXMLHandler(handler).ConcurrentXMLHandler.XMLHandlerIndexTests#schemaAttributeNameTakesTheExactSpellingFirst:LastNamegivesLastNameandlastnamegiveslastname.writeCasePairXsd, shared withattributesWhoseNamesDifferOnlyInCaseAreWrittenApart.XMLFilterSearchTests#filtersgets eight rows, searched through the facade with the framework's filtering off. Each expects what the same filter finds in the schema's case:LastName=M,startsWith(EMAIL, y),endsWith(Email, 3),contains(FirstName, '),greaterThan(AGE, 9),containsAllValues(Age, 9),__name__=a1and__uid__=uid-a1;containsAllValues, where onlycontainsAllValuesOnThePasswordInAnotherCaseThrowsfails: theEqualsFilters it builds pass throughcreateEqualsExpression, which maps the name again;XMLConnectorwith the(boolean)constructor fails seven of them, all but__uid__.XMLFilterSearchTests#filtersalso gets a row for a stray element:a2holds<ri:LastName>S</ri:LastName>beside<ri:lastname>M</ri:lastname>, asupdatewrote it before XML connector: create and update accept an attribute name in another case, then lose its value #212;LastName=Sfinds nothing;getAttributeName, and ifcreateEqualsExpressioncompares the name as given as well as the schema's.XMLFilterSearchTests#containsAllValuesOnThePasswordInAnotherCaseThrows:containsAllValueson__password__with aGuardedStringthrowsIllegalArgumentExceptionthrough the facade.createContainsAllValuesExpressionbuilds itsEqualsFilters under the name as given.__CURRENT_PASSWORD__, so that name is not tested.XMLFilterSearchTests#uidFilterInAnotherCaseFindsTheNameOnAClassWithoutUid:__GROUP__entries are added to the fixture.__uid__=g1andUid("g1")both findg1.schemaName.XMLFilterSearchTests#filterInAnotherCaseNamesTheAttributeByTheSearchedClass:__short_name__=g1on__GROUP__findsg1.XMLConnectormaps names by__ACCOUNT__'s schema, which has no__SHORT_NAME__.XMLHandlerIndexTests#anotherCaseIdentifierGoesToTheIndexUnderTheSchemasName: with the connector's mapping,__name__=xand__uid__=xgiveidentifierField__NAME__and__UID__.XMLHandlerIndexTests#uidFilterKeepsTheUidWhateverTheSchemaSpellsIt:String::toLowerCasestands for an XSD that declares__uid__.Uid("x")still gives__UID__.schemaName.With master's
getAttributeName, 13 of the runs above fail: the eight rows, the stray-element row,containsAllValuesOnThePasswordInAnotherCaseThrows,uidFilterInAnotherCaseFindsTheNameOnAClassWithoutUid,filterInAnotherCaseNamesTheAttributeByTheSearchedClassandanotherCaseIdentifierGoesToTheIndexUnderTheSchemasName. The module runs 418 tests with no failures, against 402 on master.Not covered
<ri:LastName>that the oldupdatewrote into existing files stay there, and a filter in any case no longer finds an entry by them.LASTNAMEnext tolastnameandLastName, goes to whichever of the two the framework's case-insensitive map holds, as increateandupdate.containsAllValuescompares aGuardedStringby itstoString(), as before.