%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CTYPEDESCRIPTOR%20name%3D%22%26quot%3Bdocaclmeta%26quot%3B%22%20typename%3D%22%26quot%3BSystem.String%2C%22%20mscorlib%3D%22%22%3E%3C%2FTYPEDESCRIPTOR%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIn%20the%20Method%20Instance%20definition%20we%20tell%20BCS%20what%20the%20names%20of%20these%20field%20type%20will%20be%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BUsesPluggableAuthentication%26quot%3B%22%3EUsesPluggableAuth%3C%2FPROPERTY%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BWindowsSecurityDescriptorField%26quot%3B%22%20type%3D%22%26quot%3BSystem.String%26quot%3B%22%3ESecurityDescriptor%3C%2FPROPERTY%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BDocaclmetaField%26quot%3B%22%20type%3D%22%26quot%3BSystem.String%26quot%3B%22%3Edocaclmeta%3C%2FPROPERTY%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20UsesPluggableAuth%20as%20a%20boolean%20field%20type%20%3CEM%3E%20.%20If%20the%20value%20of%20this%20field%20is%20true%2C%20then%20we%E2%80%99re%20telling%20BCS%20to%20use%20custom%20security%20claims%20instead%20of%20the%20Windows%20Security%20descriptors.%20%3C%2FEM%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20SecurityDescriptor%20as%20a%20byte%20array%20for%20the%20actual%20encoded%20claims%20data%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20docaclmeta%20as%20an%20optional%20string%20field%2C%20which%20will%20only%20be%20displayed%20in%20the%20search%20results%20if%20populated.%20This%20field%20is%20not%20queryable%20in%20the%20index.%3C%2FP%3E%3CBR%20%2F%3E%20XmlFileLoader%20Class%20%3CBR%20%2F%3E%3CP%3EIn%20the%20connector%20code%20the%20XmlFileLoader%20utility%20class%20populates%20these%20values%20into%20the%20document%20that%20is%20returned%20to%20the%20index.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIn%20some%20case%20we%20use%20logic%20to%20determine%20the%20value%20as%20here%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EUsesPluggableAuth%20%3Dsecurity%20!%3Dnull%2C%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20XmlFileLoader%20class%20also%20encodes%20the%20claim.%20Claims%20are%20encoded%20as%20a%20binary%20byte%20stream.%20The%20data%20type%20of%20this%20example%20is%20always%20of%20type%20string%20but%20this%20is%20not%20a%20requirement%20of%20the%20SharePoint%20backend.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20claims%20are%20encoded%20in%20the%20AddClaimAcl%20method%20according%20to%20these%20rules%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20first%20byte%20signals%20an%20allow%20or%20deny%20claim%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20second%20byte%20is%20always%201%20to%20indicate%20that%20this%20is%20a%20non-NT%20security%20ACL%20(i.e.%20it%20is%20a%20claim%20ACL%20type)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20next%20four%20bytes%20is%20the%20size%20of%20the%20following%20claim%20value%20array%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20claim%20value%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20value%20array%2C%20gives%20the%20length%20of%20the%20claim%20type%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20claim%20type%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20type%20array%2C%20gives%20the%20length%20of%20the%20claim%20data%20type%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20claim%20data%20type%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20data%20type%20array%2C%20gives%20the%20length%20of%20the%20claim%20original%20issuer%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%C2%B7%20The%20claim%20issuer%20string%20finally%20follows%20as%20a%20Unicode%20byte%20array.%3C%2FP%3E%3CBR%20%2F%3E%20Entity%20Class%20%3CBR%20%2F%3E%3CP%3ENaturally%2C%20we%20have%20to%20include%20the%20three%20security-related%20fields%20in%20the%20Entity%20that%20is%20returned%20by%20the%20connector%3A%3C%2FP%3E%3CBR%20%2F%3E%20public%20class%20Document%20%3CBR%20%2F%3E%20%7B%20%3CBR%20%2F%3E%20private%20DateTime%20lastModifiedTime%20%3D%20DateTime.Now%3B%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20public%20string%20Title%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%20public%20string%20DocumentID%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%20public%20string%20Url%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%20public%20DateTime%20LastModifiedTime%20%7B%20get%20%7B%20return%20this.lastModifiedTime%3B%20%7D%20set%20%7B%20this.lastModifiedTime%20%3D%20value%3B%20%7D%20%7D%20%3CBR%20%2F%3E%20public%20DocumentProperty%5B%5D%20DocumentProperties%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%20%2F%2F%20Security%20Begin%20%3CBR%20%2F%3E%20public%20Byte%5B%5D%20SecurityDescriptor%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%20public%20Boolean%20UsesPluggableAuth%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%20public%20string%20docaclmeta%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%20%2F%2F%20Security%20End%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--1017926055%22%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId-1568186199%22%20id%3D%22toc-hId-1568186199%22%20id%3D%22toc-hId-1568186199%22%20id%3D%22toc-hId-1568186199%22%20id%3D%22toc-hId-1568186199%22%20id%3D%22toc-hId-1568186199%22%20id%3D%22toc-hId-1568186199%22%20id%3D%22toc-hId-1568186199%22%3EProducts.xml%3C%2FH3%3E%3CBR%20%2F%3E%3CP%3EIn%20the%20example%20all%20the%20documents%20are%20returned%20from%20one%20XML%20file%2C%20but%20here%20is%20one%20Product%20from%20that%20file%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CPRODUCT%3E%3C%2FPRODUCT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CID%3E1%3C%2FID%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CURL%3Ehttp%3A%2F%2Fwfe%2Fsite%2Fcatalog%2Fitem1%3C%2FURL%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CTITLE%3EAdventure%20Works%20Laptop15.4W%20M1548%20White%3C%2FTITLE%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CITEM_X0020_NUMBER%3E1010101%3C%2FITEM_X0020_NUMBER%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CGROUP_X0020_NUMBER%3E10101%3C%2FGROUP_X0020_NUMBER%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CITEMCATEGORYNUMBER%3E101%3C%2FITEMCATEGORYNUMBER%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CITEMCATEGORYTEXT%3ELaptops%3C%2FITEMCATEGORYTEXT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CABOUT%3ELaptop%20with%20640%20GB%20hard%20drive%20and%204%20GB%20RAM.%2015.4-inch%20widescreen%20TFT%20LED%20display.%203%20high-speed%20USB%20ports.%20Built-in%20webcam%20and%20DVD%2FCD-RW%20drive.%20%3C%2FABOUT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CUNITPRICE%3E%24758%2C00%3C%2FUNITPRICE%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CBRAND%3EAdventure%20Works%3C%2FBRAND%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CCOLOR%3EWhite%3C%2FCOLOR%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CWEIGHT%3E3.2%3C%2FWEIGHT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSCREENSIZE%3E15.4%3C%2FSCREENSIZE%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CMEMORY%3E1000%3C%2FMEMORY%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CHARDDRIVE%3E160%3C%2FHARDDRIVE%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CCAMPAIGN%3E0%3C%2FCAMPAIGN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CONSALE%3E1%3C%2FONSALE%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CDISCOUNT%3E-0.2%3C%2FDISCOUNT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CLANGUAGE_X0020_TAG%3Een-US%3C%2FLANGUAGE_X0020_TAG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C!--%20Security%20Begin%20--%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CCLAIMTYPE%3E%3CA%20href%3D%22http%3A%2F%2Fsurface.microsoft.com%2Fsecurity%2Facl%26lt%3B%2Fclaimtype%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fsurface.microsoft.com%2Fsecurity%2Facl%3C%2FA%3E%3C%2FCLAIMTYPE%3E%26gt%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CCLAIMVALUE%3Euser1%3C%2FCLAIMVALUE%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CCLAIMISSUER%3Ecustomtrimmer%3C%2FCLAIMISSUER%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CCLAIMACLMETA%3Eaccess%3C%2FCLAIMACLMETA%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C!--%20Security%20End%C2%A0%C2%A0%20--%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ENote%20that%20the%20last%204%20elements%20specify%20the%20claim%20value%20that%20will%20be%20evaluated%20by%20the%20Security%20Descriptor%20member%20that%20is%20returned%20in%20the%20Entity.%3C%2FP%3E%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-724884280%22%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId--983970762%22%3ECustom%20Security%20Pre-Trimmer%20Implementation%3C%2FH3%3E%3CBR%20%2F%3E%3CP%3EThe%20new%20pre-trimmer%20type%20is%20where%20the%20trimmer%20logic%20is%20invoked%20pre-query%20evaluation.%20The%20search%20server%20backend%20rewrites%20the%20query%20adding%20security%20information%20before%20the%20index%20lookup%20in%20the%20search%20index.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EBecause%20the%20data%20source%20contains%20information%20about%20the%20claims%20that%20are%20accepted%2C%20the%20lookup%20can%20return%20only%20the%20appropriate%20results%20that%20satisfy%20the%20claim%20demand.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E%20Benefits%20of%20Pre-Trimming%20%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EPre-trimming%20has%20better%20performance%20metrics%20so%20that%20is%20the%20method%20that%20is%20most%20recommended.%20Besides%20that%20the%20new%20Framework%20makes%20it%20easy%20to%20specify%20simple%20claims%20(in%20the%20form%20of%20strings)%20instead%20of%20having%20to%20encode%20ACLs%20in%20the%20form%20of%20Byte%20Arrays%20in%20the%20data%20source%20(something%20which%20can%20be%20quite%20time%20consuming%20and%20difficult).%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ETo%20create%20a%20custom%20security%20pre-trimmer%20we%20must%20implement%20the%20two%20methods%20of%20ISecurityTrimmerPre.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIEnumerable%3CTUPLE%3E%3CMICROSOFT.IDENTITYMODEL.CLAIMS.CLAIM%3E%26gt%3B%20AddAccess(IDictionary%3CSTRING%3E%20sessionProperties%2C%20IIdentityuserIdentity)%3B%3C%2FSTRING%3E%3C%2FMICROSOFT.IDENTITYMODEL.CLAIMS.CLAIM%3E%3C%2FTUPLE%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Evoid%20Initialize(NameValueCollection%20staticProperties%2C%20SearchServiceApplication%20searchApplication)%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%20The%20Membership%20Data%20(DataFile.txt)%20%3CBR%20%2F%3E%3CP%3EIn%20the%20beginning%20of%20the%20SearchPreTrimmer%20class%20I%20set%20the%20path%20to%20the%20datafile.txt%20membership%20file%20to%20%40%22c%3A%5Cmembership%5Cdatafile.txt%22.%20You%E2%80%99ll%20need%20to%20either%20change%20that%20or%20put%20your%20membership%20file%20there.%20The%20included%20example%20is%20basically%20blank%20but%20here%20is%20what%20mine%20looks%20like%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E%20domain%5Cusername%3Auser1%3Buser3%3Buser2%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E%20contoso%5Caaronp%3Auser1%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E%20contoso%5Cadamb%3Auser2%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E%20contoso%5Cadambu%3Auser1%3Buser2%3Buser3%20%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E%20contoso%5Calanb%3Auser3%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20identity%20of%20the%20user%20is%20the%20first%20thing%20on%20every%20line%20and%20then%20comes%20a%20colon.%20After%20that%20is%20a%20list%20of%20claims%2C%20separated%20by%20semicolons.%20I%20left%20the%20user1%2C%20user2%2C%20user3%20claims%2C%20but%20you%20could%20make%20it%20%E2%80%9Ceditor%E2%80%9D%2C%20%E2%80%9Capprover%E2%80%9D%2C%20%E2%80%9Cmajordomo%E2%80%9D%20or%20whatever%20group%20claims%20make%20sense%20to%20you.%20You%20don%E2%80%99t%20have%20to%20think%20of%20it%20as%20groups%2C%20it%20just%20a%20string%20claim.%20The%20data%20that%20is%20crawled%20by%20the%20connector%20will%20specify%20the%20list%20of%20claims%20that%20can%20view%20that%20item%20in%20the%20search%20results.%3C%2FP%3E%3CBR%20%2F%3E%20Initialize%20%3CBR%20%2F%3E%3CP%3EThe%20main%20thing%20you%E2%80%99ll%20be%20doing%20in%20Initialize%20is%20setting%20the%20values%20of%20claim%20type%2C%20the%20claim%20issuer%20and%20the%20path%20to%20the%20datafile.%20The%20claim%20type%20and%20claim%20issuer%20are%20very%20important%20because%20the%20trimmer%20will%20use%20this%20information%20to%20determine%20whether%20and%20how%20to%20apply%20the%20demands%20for%20claims.%20The%20path%20to%20the%20data%20file%20is%20important%20because%20that%20is%20where%20the%20membership%20is%20specified.%20You%20can%20think%20of%20it%20as%20a%20membership%20provider%20just%20for%20the%20specific%20claims%20that%20you%20want%20to%20inject%20for%20the%20purposes%20of%20your%20custom%20trimming.%20It%20The%20framework%20passes%20in%20a%20NameValueCollection%20and%20it%E2%80%99s%20possible%20values%20could%20be%20sent%20in%20from%20there.%20You%20will%20probably%20want%20to%20set%20default%20values%20as%20we%20do%20in%20the%20example.%3C%2FP%3E%3CBR%20%2F%3E%20AddAccess%20%3CBR%20%2F%3E%3CP%3EThe%20AddAccess%20method%20of%20the%20trimmer%20is%20responsible%20for%20returning%20claims%20to%20be%20added%20to%20the%20query%20tree.%20The%20method%20has%20to%20return%20an%20IEnumerable%3CTUPLE%3E%3CCLAIM%3E%26gt%3B%20but%20a%20Linked%20List%20is%20appropriate%20because%20it%20orders%20the%20claims%20in%20the%20same%20order%20that%20they%20were%20added%20in%20the%20datafile.%3C%2FCLAIM%3E%3C%2FTUPLE%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20group%20membership%20data%20is%20refreshed%20every%2030%20seconds%20which%20is%20specified%20in%20the%20RefreshDataFile%20method.%20RefreshDataFile%20uses%20a%20utility%20wrapper%20class%20(Lookup)%20to%20load%20the%20membership%20data%20into%20a%20simple%20to%20use%20collection.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20framework%20calls%20AddAccess%20passing%20in%20the%20identity%20with%20the%20claims%20we%20attached%20in%20the%20datafile%20specified%20in%20Initialize.%20Then%20we%20loop%20through%20those%20claims%20and%20add%20them%20to%20the%20IEnumerable%20of%20claims%20that%20AddAccess%20returns.%3C%2FP%3E%3CBR%20%2F%3E%20Installing%20and%20Debugging%20the%20Pre-Trimmer%20%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3ETo%20register%20the%20custom%20trimmer%20%3C%2FSTRONG%3E%20%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ENew-SPEnterpriseSearchSecurityTrimmer%20-SearchApplication%20%22Search%20Service%20Application%22%20%3CBR%20%2F%3E%20-typeName%20%22CstSearchPreTrimmer.SearchPreTrimmer%2C%20CstSearchPreTrimmer%2CVersion%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dtoken%22%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E-id%201%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Enet%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Enet%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20%E2%80%93id%20parameter%20is%20just%20an%20index%20in%20the%20collection.%20I%20think%20it%E2%80%99s%20arbitrary.%20I%20had%20to%20put%20a%20value%20though.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E%20To%20debug%20the%20pre-trimmer%20code%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EYou%20may%20not%20need%20to%20do%20this%20and%20you%20won%E2%80%99t%20want%20to%20do%20it%20too%20often%2C%20but%20if%20you%20have%20complex%20logic%20in%20any%20of%20the%20code%20that%20retrieves%20or%20sets%20the%20static%20properties%20of%20the%20trimmer%2C%20you%20may%20want%20to%20debug%20the%20code.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20had%20to%20do%20the%20following%20things.%20I%E2%80%99m%20really%20not%20sure%20if%20all%20of%20them%20are%20necessary%2C%20but%20I%20could%20not%20break%20in%20without%20doing%20all%20of%20them%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E1)%20Build%20and%20GAC%20the%20debug%20version%20of%20the%20SearchPreTrimmer%20to%20make%20sure%20you%20have%20the%20same%20version%20installed.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E2)%20Remove%20the%20Security%20Trimmer%20with%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%24searchapp%20%3D%20Get-SPEnterpriseSearchServiceApplication%20-Identity%20%22Search%20Service%20Application%22%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ERemove-SPEnterpriseSearchSecurityTrimmer%20-SearchApplication%20%24searchapp%20-Identity%201%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E3)%20Restart%20the%20Search%20Service%20Host.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Ea.%20net%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Eb.%20net%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E4)%20IIS%20Reset.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E5)%20Re-register%20the%20security%20trimmer%20using%20register%20script%20above.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E6)%20Restart%20the%20Search%20Service%20Host.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Ea.%20net%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Eb.%20net%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E7)%20Use%20appcmd%20list%20wp%20to%20get%20the%20correct%20Worker%20Process%20ID%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E8)%3C%2Fimg%3E%20Attach%20to%20the%20correct%20w3wp.exe%20and%20all%20noderunner.exe%20instances%20(not%20sure%20if%20there%E2%80%99s%20a%20way%20to%20get%20the%20correct%20instance%20or%20not).%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E9)%20Start%20start%20a%20Search%20using%20and%20%3CSTRONG%3E%20Enterprise%20Search%20Center%20Site%20Collection.%20%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20got%20frequent%20problems%20like%20time%20outs%20and%20I%20always%20had%20to%20start%20the%20search%20on%20the%20same%20login%20account%20as%20Visual%20Studio%20was%20running%20in.%20Nevertheless%20it%20was%20possible%20and%20I%20did%20it%20more%20than%20once%20with%20the%20same%20steps%20as%20above.%3C%2FP%3E%3CBR%20%2F%3E%20Conclusion%20%3CBR%20%2F%3E%3CP%3EWe%E2%80%99ve%20covered%20the%20basics%20of%20how%20claims%20are%20sent%20to%20SharePoint%20in%20the%20customer%20connector.%20We%20covered%20the%20basics%20of%20the%20custom%20Security%20Pre-Trimmer%20in%20SharePoint%202013%20and%20how%20it%20can%20use%20the%20claims%20sent%20by%20the%20custom%20connector%20to%20let%20the%20Query%20Engine%20specify%20claims-based%20ACLs%20so%20that%20only%20relevant%20result%20are%20returned%20to%20the%20results%20page.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FTNBlogsFS%2Fprod.evol.blogs.technet.com%2Ftelligent.evolution.components.attachments%2F01%2F9350%2F00%2F00%2F03%2F57%2F52%2F17%2FSearchSecuirtyTrimmerExample.zip%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20SearchSecuirtyTrimmerExample.zip%20%3C%2FA%3E%3C%2FP%3E%0A%20%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CTYPEDESCRIPTOR%20name%3D%22%26quot%3Bdocaclmeta%26quot%3B%22%20typename%3D%22%26quot%3BSystem.String%2C%22%20mscorlib%3D%22%22%3E%3C%2FTYPEDESCRIPTOR%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20Method%20Instance%20definition%20we%20tell%20BCS%20what%20the%20names%20of%20these%20field%20type%20will%20be%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BUsesPluggableAuthentication%26quot%3B%22%3EUsesPluggableAuth%3C%2FPROPERTY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BWindowsSecurityDescriptorField%26quot%3B%22%20type%3D%22%26quot%3BSystem.String%26quot%3B%22%3ESecurityDescriptor%3C%2FPROPERTY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BDocaclmetaField%26quot%3B%22%20type%3D%22%26quot%3BSystem.String%26quot%3B%22%3Edocaclmeta%3C%2FPROPERTY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20UsesPluggableAuth%20as%20a%20boolean%20field%20type%20%3CEM%3E%20.%20If%20the%20value%20of%20this%20field%20is%20true%2C%20then%20we%E2%80%99re%20telling%20BCS%20to%20use%20custom%20security%20claims%20instead%20of%20the%20Windows%20Security%20descriptors.%20%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20SecurityDescriptor%20as%20a%20byte%20array%20for%20the%20actual%20encoded%20claims%20data%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20docaclmeta%20as%20an%20optional%20string%20field%2C%20which%20will%20only%20be%20displayed%20in%20the%20search%20results%20if%20populated.%20This%20field%20is%20not%20queryable%20in%20the%20index.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EXmlFileLoader%20Class%3C%2FP%3E%0A%3CP%3EIn%20the%20connector%20code%20the%20XmlFileLoader%20utility%20class%20populates%20these%20values%20into%20the%20document%20that%20is%20returned%20to%20the%20index.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20some%20case%20we%20use%20logic%20to%20determine%20the%20value%20as%20here%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUsesPluggableAuth%20%3Dsecurity%20!%3Dnull%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20XmlFileLoader%20class%20also%20encodes%20the%20claim.%20Claims%20are%20encoded%20as%20a%20binary%20byte%20stream.%20The%20data%20type%20of%20this%20example%20is%20always%20of%20type%20string%20but%20this%20is%20not%20a%20requirement%20of%20the%20SharePoint%20backend.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20claims%20are%20encoded%20in%20the%20AddClaimAcl%20method%20according%20to%20these%20rules%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20first%20byte%20signals%20an%20allow%20or%20deny%20claim%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20second%20byte%20is%20always%201%20to%20indicate%20that%20this%20is%20a%20non-NT%20security%20ACL%20(i.e.%20it%20is%20a%20claim%20ACL%20type)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20next%20four%20bytes%20is%20the%20size%20of%20the%20following%20claim%20value%20array%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20claim%20value%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20value%20array%2C%20gives%20the%20length%20of%20the%20claim%20type%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20claim%20type%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20type%20array%2C%20gives%20the%20length%20of%20the%20claim%20data%20type%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20claim%20data%20type%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20data%20type%20array%2C%20gives%20the%20length%20of%20the%20claim%20original%20issuer%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20claim%20issuer%20string%20finally%20follows%20as%20a%20Unicode%20byte%20array.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EEntity%20Class%3C%2FP%3E%0A%3CP%3ENaturally%2C%20we%20have%20to%20include%20the%20three%20security-related%20fields%20in%20the%20Entity%20that%20is%20returned%20by%20the%20connector%3A%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3Epublic%20class%20Document%20%3CBR%20%2F%3E%7B%20%3CBR%20%2F%3Eprivate%20DateTime%20lastModifiedTime%20%3D%20DateTime.Now%3B%20%3CBR%20%2F%3E%3CBR%20%2F%3Epublic%20string%20Title%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20string%20DocumentID%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20string%20Url%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20DateTime%20LastModifiedTime%20%7B%20get%20%7B%20return%20this.lastModifiedTime%3B%20%7D%20set%20%7B%20this.lastModifiedTime%20%3D%20value%3B%20%7D%20%7D%20%3CBR%20%2F%3Epublic%20DocumentProperty%5B%5D%20DocumentProperties%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%2F%2F%20Security%20Begin%20%3CBR%20%2F%3Epublic%20Byte%5B%5D%20SecurityDescriptor%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20Boolean%20UsesPluggableAuth%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20string%20docaclmeta%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%2F%2F%20Security%20End%20%3CBR%20%2F%3E%7D%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId--1793317388%22%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId-758839573%22%3EProducts.xml%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20example%20all%20the%20documents%20are%20returned%20from%20one%20XML%20file%2C%20but%20here%20is%20one%20Product%20from%20that%20file%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPRODUCT%3E%3C%2FPRODUCT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CID%3E1%3C%2FID%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CURL%3Ehttp%3A%2F%2Fwfe%2Fsite%2Fcatalog%2Fitem1%3C%2FURL%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CTITLE%3EAdventure%20Works%20Laptop15.4W%20M1548%20White%3C%2FTITLE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CITEM_X0020_NUMBER%3E1010101%3C%2FITEM_X0020_NUMBER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CGROUP_X0020_NUMBER%3E10101%3C%2FGROUP_X0020_NUMBER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CITEMCATEGORYNUMBER%3E101%3C%2FITEMCATEGORYNUMBER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CITEMCATEGORYTEXT%3ELaptops%3C%2FITEMCATEGORYTEXT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CABOUT%3ELaptop%20with%20640%20GB%20hard%20drive%20and%204%20GB%20RAM.%2015.4-inch%20widescreen%20TFT%20LED%20display.%203%20high-speed%20USB%20ports.%20Built-in%20webcam%20and%20DVD%2FCD-RW%20drive.%20%3C%2FABOUT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CUNITPRICE%3E%24758%2C00%3C%2FUNITPRICE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBRAND%3EAdventure%20Works%3C%2FBRAND%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCOLOR%3EWhite%3C%2FCOLOR%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CWEIGHT%3E3.2%3C%2FWEIGHT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSCREENSIZE%3E15.4%3C%2FSCREENSIZE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CMEMORY%3E1000%3C%2FMEMORY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CHARDDRIVE%3E160%3C%2FHARDDRIVE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCAMPAIGN%3E0%3C%2FCAMPAIGN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CONSALE%3E1%3C%2FONSALE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CDISCOUNT%3E-0.2%3C%2FDISCOUNT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CLANGUAGE_X0020_TAG%3Een-US%3C%2FLANGUAGE_X0020_TAG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C!--%20Security%20Begin%20--%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCLAIMTYPE%3E%3CA%20href%3D%22http%3A%2F%2Fsurface.microsoft.com%2Fsecurity%2Facl%26lt%3B%2Fclaimtype%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fsurface.microsoft.com%2Fsecurity%2Facl%3C%2FA%3E%3C%2FCLAIMTYPE%3E%26gt%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCLAIMVALUE%3Euser1%3C%2FCLAIMVALUE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCLAIMISSUER%3Ecustomtrimmer%3C%2FCLAIMISSUER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCLAIMACLMETA%3Eaccess%3C%2FCLAIMACLMETA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C!--%20Security%20End%C2%A0%C2%A0%20--%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote%20that%20the%20last%204%20elements%20specify%20the%20claim%20value%20that%20will%20be%20evaluated%20by%20the%20Security%20Descriptor%20member%20that%20is%20returned%20in%20the%20Entity.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId--50507053%22%20id%3D%22toc-hId--1793317388%22%20id%3D%22toc-hId--1793317388%22%20id%3D%22toc-hId--1793317388%22%20id%3D%22toc-hId--1793317388%22%20id%3D%22toc-hId--1793317388%22%20id%3D%22toc-hId--1793317388%22%20id%3D%22toc-hId--1793317388%22%3ECustom%20Security%20Pre-Trimmer%20Implementation%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20new%20pre-trimmer%20type%20is%20where%20the%20trimmer%20logic%20is%20invoked%20pre-query%20evaluation.%20The%20search%20server%20backend%20rewrites%20the%20query%20adding%20security%20information%20before%20the%20index%20lookup%20in%20the%20search%20index.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBecause%20the%20data%20source%20contains%20information%20about%20the%20claims%20that%20are%20accepted%2C%20the%20lookup%20can%20return%20only%20the%20appropriate%20results%20that%20satisfy%20the%20claim%20demand.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Benefits%20of%20Pre-Trimming%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPre-trimming%20has%20better%20performance%20metrics%20so%20that%20is%20the%20method%20that%20is%20most%20recommended.%20Besides%20that%20the%20new%20Framework%20makes%20it%20easy%20to%20specify%20simple%20claims%20(in%20the%20form%20of%20strings)%20instead%20of%20having%20to%20encode%20ACLs%20in%20the%20form%20of%20Byte%20Arrays%20in%20the%20data%20source%20(something%20which%20can%20be%20quite%20time%20consuming%20and%20difficult).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20create%20a%20custom%20security%20pre-trimmer%20we%20must%20implement%20the%20two%20methods%20of%20ISecurityTrimmerPre.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIEnumerable%3CTUPLE%3E%3CMICROSOFT.IDENTITYMODEL.CLAIMS.CLAIM%3E%26gt%3B%20AddAccess(IDictionary%3CSTRING%3E%20sessionProperties%2C%20IIdentityuserIdentity)%3B%3C%2FSTRING%3E%3C%2FMICROSOFT.IDENTITYMODEL.CLAIMS.CLAIM%3E%3C%2FTUPLE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Evoid%20Initialize(NameValueCollection%20staticProperties%2C%20SearchServiceApplication%20searchApplication)%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EThe%20Membership%20Data%20(DataFile.txt)%3C%2FP%3E%0A%3CP%3EIn%20the%20beginning%20of%20the%20SearchPreTrimmer%20class%20I%20set%20the%20path%20to%20the%20datafile.txt%20membership%20file%20to%20%40%22c%3A%5Cmembership%5Cdatafile.txt%22.%20You%E2%80%99ll%20need%20to%20either%20change%20that%20or%20put%20your%20membership%20file%20there.%20The%20included%20example%20is%20basically%20blank%20but%20here%20is%20what%20mine%20looks%20like%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20domain%5Cusername%3Auser1%3Buser3%3Buser2%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20contoso%5Caaronp%3Auser1%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20contoso%5Cadamb%3Auser2%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20contoso%5Cadambu%3Auser1%3Buser2%3Buser3%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20contoso%5Calanb%3Auser3%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20identity%20of%20the%20user%20is%20the%20first%20thing%20on%20every%20line%20and%20then%20comes%20a%20colon.%20After%20that%20is%20a%20list%20of%20claims%2C%20separated%20by%20semicolons.%20I%20left%20the%20user1%2C%20user2%2C%20user3%20claims%2C%20but%20you%20could%20make%20it%20%E2%80%9Ceditor%E2%80%9D%2C%20%E2%80%9Capprover%E2%80%9D%2C%20%E2%80%9Cmajordomo%E2%80%9D%20or%20whatever%20group%20claims%20make%20sense%20to%20you.%20You%20don%E2%80%99t%20have%20to%20think%20of%20it%20as%20groups%2C%20it%20just%20a%20string%20claim.%20The%20data%20that%20is%20crawled%20by%20the%20connector%20will%20specify%20the%20list%20of%20claims%20that%20can%20view%20that%20item%20in%20the%20search%20results.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EInitialize%3C%2FP%3E%0A%3CP%3EThe%20main%20thing%20you%E2%80%99ll%20be%20doing%20in%20Initialize%20is%20setting%20the%20values%20of%20claim%20type%2C%20the%20claim%20issuer%20and%20the%20path%20to%20the%20datafile.%20The%20claim%20type%20and%20claim%20issuer%20are%20very%20important%20because%20the%20trimmer%20will%20use%20this%20information%20to%20determine%20whether%20and%20how%20to%20apply%20the%20demands%20for%20claims.%20The%20path%20to%20the%20data%20file%20is%20important%20because%20that%20is%20where%20the%20membership%20is%20specified.%20You%20can%20think%20of%20it%20as%20a%20membership%20provider%20just%20for%20the%20specific%20claims%20that%20you%20want%20to%20inject%20for%20the%20purposes%20of%20your%20custom%20trimming.%20It%20The%20framework%20passes%20in%20a%20NameValueCollection%20and%20it%E2%80%99s%20possible%20values%20could%20be%20sent%20in%20from%20there.%20You%20will%20probably%20want%20to%20set%20default%20values%20as%20we%20do%20in%20the%20example.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAddAccess%3C%2FP%3E%0A%3CP%3EThe%20AddAccess%20method%20of%20the%20trimmer%20is%20responsible%20for%20returning%20claims%20to%20be%20added%20to%20the%20query%20tree.%20The%20method%20has%20to%20return%20an%20IEnumerable%3CTUPLE%3E%3CCLAIM%3E%26gt%3B%20but%20a%20Linked%20List%20is%20appropriate%20because%20it%20orders%20the%20claims%20in%20the%20same%20order%20that%20they%20were%20added%20in%20the%20datafile.%3C%2FCLAIM%3E%3C%2FTUPLE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20group%20membership%20data%20is%20refreshed%20every%2030%20seconds%20which%20is%20specified%20in%20the%20RefreshDataFile%20method.%20RefreshDataFile%20uses%20a%20utility%20wrapper%20class%20(Lookup)%20to%20load%20the%20membership%20data%20into%20a%20simple%20to%20use%20collection.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20framework%20calls%20AddAccess%20passing%20in%20the%20identity%20with%20the%20claims%20we%20attached%20in%20the%20datafile%20specified%20in%20Initialize.%20Then%20we%20loop%20through%20those%20claims%20and%20add%20them%20to%20the%20IEnumerable%20of%20claims%20that%20AddAccess%20returns.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EInstalling%20and%20Debugging%20the%20Pre-Trimmer%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ETo%20register%20the%20custom%20trimmer%20%3C%2FSTRONG%3E%20%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENew-SPEnterpriseSearchSecurityTrimmer%20-SearchApplication%20%22Search%20Service%20Application%22%20%3CBR%20%2F%3E-typeName%20%22CstSearchPreTrimmer.SearchPreTrimmer%2C%20CstSearchPreTrimmer%2CVersion%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dtoken%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-id%201%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Enet%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Enet%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20%E2%80%93id%20parameter%20is%20just%20an%20index%20in%20the%20collection.%20I%20think%20it%E2%80%99s%20arbitrary.%20I%20had%20to%20put%20a%20value%20though.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20To%20debug%20the%20pre-trimmer%20code%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20may%20not%20need%20to%20do%20this%20and%20you%20won%E2%80%99t%20want%20to%20do%20it%20too%20often%2C%20but%20if%20you%20have%20complex%20logic%20in%20any%20of%20the%20code%20that%20retrieves%20or%20sets%20the%20static%20properties%20of%20the%20trimmer%2C%20you%20may%20want%20to%20debug%20the%20code.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20had%20to%20do%20the%20following%20things.%20I%E2%80%99m%20really%20not%20sure%20if%20all%20of%20them%20are%20necessary%2C%20but%20I%20could%20not%20break%20in%20without%20doing%20all%20of%20them%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1)%20Build%20and%20GAC%20the%20debug%20version%20of%20the%20SearchPreTrimmer%20to%20make%20sure%20you%20have%20the%20same%20version%20installed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2)%20Remove%20the%20Security%20Trimmer%20with%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%24searchapp%20%3D%20Get-SPEnterpriseSearchServiceApplication%20-Identity%20%22Search%20Service%20Application%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERemove-SPEnterpriseSearchSecurityTrimmer%20-SearchApplication%20%24searchapp%20-Identity%201%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3)%20Restart%20the%20Search%20Service%20Host.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ea.%20net%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eb.%20net%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E4)%20IIS%20Reset.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E5)%20Re-register%20the%20security%20trimmer%20using%20register%20script%20above.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E6)%20Restart%20the%20Search%20Service%20Host.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ea.%20net%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eb.%20net%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E7)%20Use%20appcmd%20list%20wp%20to%20get%20the%20correct%20Worker%20Process%20ID%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E8)%3C%2Fimg%3E%20Attach%20to%20the%20correct%20w3wp.exe%20and%20all%20noderunner.exe%20instances%20(not%20sure%20if%20there%E2%80%99s%20a%20way%20to%20get%20the%20correct%20instance%20or%20not).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E9)%20Start%20start%20a%20Search%20using%20and%20%3CSTRONG%3E%20Enterprise%20Search%20Center%20Site%20Collection.%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20got%20frequent%20problems%20like%20time%20outs%20and%20I%20always%20had%20to%20start%20the%20search%20on%20the%20same%20login%20account%20as%20Visual%20Studio%20was%20running%20in.%20Nevertheless%20it%20was%20possible%20and%20I%20did%20it%20more%20than%20once%20with%20the%20same%20steps%20as%20above.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EConclusion%3C%2FP%3E%0A%3CP%3EWe%E2%80%99ve%20covered%20the%20basics%20of%20how%20claims%20are%20sent%20to%20SharePoint%20in%20the%20customer%20connector.%20We%20covered%20the%20basics%20of%20the%20custom%20Security%20Pre-Trimmer%20in%20SharePoint%202013%20and%20how%20it%20can%20use%20the%20claims%20sent%20by%20the%20custom%20connector%20to%20let%20the%20Query%20Engine%20specify%20claims-based%20ACLs%20so%20that%20only%20relevant%20result%20are%20returned%20to%20the%20results%20page.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FTNBlogsFS%2Fprod.evol.blogs.technet.com%2Ftelligent.evolution.components.attachments%2F01%2F9350%2F00%2F00%2F03%2F57%2F52%2F17%2FSearchSecuirtyTrimmerExample.zip%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20SearchSecuirtyTrimmerExample.zip%20%3C%2FA%3E%3C%2FP%3E%3CLINGO-SUB%20id%3D%22lingo-sub-509801%22%20slang%3D%22en-US%22%3EImplementing%20a%20Custom%20Security%20Pre-Trimmer%20with%20Claims%20in%20SharePoint%202013%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-509801%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3E%20First%20published%20on%20TECHNET%20on%20May%2028%2C%202013%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThis%20post%20is%20a%20contribution%20from%20Adam%20Burns%2C%20an%20engineer%20with%20the%20SharePoint%20Developer%20Support%20team.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20post%20repackages%20examples%20that%20are%20already%20out%20there%20on%20MSDN%2C%20but%20brings%20two%20examples%20together%20and%20provides%20some%20implementation%20details%20that%20may%20not%20be%20obvious%20in%20the%20existing%20articles.%20I%20also%20tried%20to%20leave%20out%20confusing%20details%20that%20didn%E2%80%99t%20bear%20directly%20on%20the%20subject%20of%20using%20custom%20claims%20to%20do%20Pre-Trimming%20of%20search%20results.%20In%20general%20you%20should%20look%20at%20the%20included%20sample%20code%20after%20reading%20the%20description%20of%20the%20different%20parts%20and%20that%20should%20be%20enough%20to%20understand%20the%20concepts.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EWhat%20you%20will%20learn%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EWe%20will%20review%20basic%20concept%20of%20a%20custom%20Indexing%20Connector%20because%20we%20will%20have%20to%20implement%20a%20connector%20in%20order%20to%20demonstrate%20the%20capabilities%20of%20the%20new%20Security%20Trimmer%20Framework.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EWe%E2%80%99ll%20cover%20how%20a%20connector%20can%20provide%20Claims%20to%20the%20Indexer%20and%20how%20the%20Security%20Trimmer%20can%20use%20those%20Claims%20to%20provide%20a%20very%20flexibly%20way%20to%20trim%20and%20customize%20search%20results.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EWe%E2%80%99ll%20quickly%20cover%20the%20different%20between%20a%20pre-%20and%20post-%20trimmer%20but%20we%E2%80%99ll%20only%20implement%20the%20pre-trimmer.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3ESample%20Code%3A%3C%2FP%3E%0A%3CP%3EThe%20sample%20code%20includes%20two%20projects%2C%20the%20Custom%20Indexing%20Connector%20(XmlFileConnector)%20which%20sends%20claims%20to%20BCS%2C%20and%20the%20SearchPreTrimmer%20project%20which%20actually%20implements%20the%20trimming.%20In%20addition%20you%E2%80%99ll%20find%3A%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EProducts.xml%20-%20a%20sample%20external%20data%20file%20for%20crawling.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EXmldoc.reg%20-%20to%20set%20the%20proper%20registry%20value%20so%20that%20the%20custom%20protocol%20is%20handled%20by%20the%20connector.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EDatafile.txt%20%E2%80%93%20a%20sample%20membership%20data%20file.%20This%20is%20where%20the%20claims%20for%20each%20user%20are%20specified.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1568186199%22%20id%3D%22toc-hId--50507053%22%20id%3D%22toc-hId--50507053%22%20id%3D%22toc-hId--50507053%22%20id%3D%22toc-hId--50507053%22%20id%3D%22toc-hId--50507053%22%20id%3D%22toc-hId--50507053%22%20id%3D%22toc-hId--50507053%22%3EThe%20Connector%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%E2%80%99ll%20use%20the%20XmlFileConnector.%20One%20of%20the%20good%20things%20about%20this%20kind%20of%20connector%20is%20that%20you%20can%20use%20it%20for%20a%20database.%20For%20instance%20it%20can%20be%20a%20product%20catalog%2C%20a%20navigation%20source%2C%20etc.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20install%20the%20connector%20do%20the%20below%20steps%20(All%20paths%20are%20examples%20and%20can%20easily%20be%20substituted%20for%20applicable%20paths%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20Build%20the%20included%20XmlFileConnector%20project.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.%20Open%20the%20%E2%80%9C%20%3CSTRONG%3E%20Developer%20Command%20Prompt%20for%20Visual%20Studio%202012%20%3C%2FSTRONG%3E%20%E2%80%9D%20and%20type%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20723px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111480iCAA42F6FC2540832%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3.%20%3CSTRONG%3EMerge%20the%20registry%20entries%20for%20the%20protocol%20handler%20%3C%2FSTRONG%3E%20by%20double-clicking%20on%20the%20registry%20file%20located%20at%20%E2%80%9CC%3A%5CUsers%5Cadministrator.CONTOSO%5CDocuments%5CVisual%20Studio%202012%5CProjects%5CSearchSecuirtyTrimmerExample%5CXmlFileConnector%5Cxmldoc.reg%E2%80%9D.%20That%E2%80%99s%20the%20protocol%20handler%20part%20of%20all%20this.%20Unless%20SharePoint%20knows%20about%20the%20protocol%20you%20are%20registering%20the%20connector%20won%E2%80%99t%20work.%20Registering%20the%20custom%20protocol%20is%20a%20requirement%20for%20custom%20indexing%20connectors%20in%20SharePoint.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E4.%20Open%20%E2%80%9C%20%3CSTRONG%3E%20SharePoint%202103%20Management%20Shell%20%3C%2FSTRONG%3E%20%E2%80%9D%20and%20type%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20707px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111481i864A1ABF7AC0037C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E5.%20You%20can%20check%20the%20success%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet-SPEnterpriseSearchCrawlCustomConnector%20-SearchApplication%20%24searchapp%20%7C%20ft%20-Wrap%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20should%20get%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20709px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111482iA7525E0FFBD67189%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E6.%20Stop%20and%20Start%20the%20Search%20Service%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20213px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111484iDAA45482C6FF95E6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E7.%20Create%20a%20%3CSTRONG%3E%20Crawled%20Property%20Category%20%3C%2FSTRONG%3E%20.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20the%20custom%20indexing%20connector%20crawls%20content%20the%20properties%20discovered%20and%20indexed%20will%20have%20to%20be%20assigned%20to%20a%20Crawled%20Property%20Connector.%20You%20will%20associate%20the%20category%20with%20the%20Connector.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELater%20on%2C%20if%20you%20want%20to%20have%20Navigation%20by%20Search%20or%20Content%20By%20Search%2C%20you%20will%20want%20to%20create%20a%20managed%20property%20and%20map%20it%20to%20one%20of%20the%20custom%20properties%20in%20this%20Crawled%20Property%20Category.%20This%20will%20allow%20to%20present%20content%20using%20Managed%20Navigation%20and%20the%20Content%20Search%20Web%20Part%20(note%20that%20Content%20Search%20Web%20Part%20is%20not%20present%20in%20SharePoint%20Online%20yet%2C%20but%20it%20is%20coming%20in%20the%20future).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20create%20a%20new%20crawled%20property%20category%2C%20open%20SharePoint%202013%20Management%20Shell%20and%20type%20the%20following%20commands%20and%20run%20them%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ea.%20%24searchapp%20%3D%20Get-SPEnterpriseSearchServiceApplication%20-Identity%20%22%3CYOURSEARCHSERVICENAME%3E%22%3C%2FYOURSEARCHSERVICENAME%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eb.%20New-SPEnterpriseSearchMetadataCategory%20-Name%20%22XmlFileConnector%22%20-Propset%20%22BCC9619B-BFBD-4BD6-8E51-466F9241A27A%22%20-searchApplication%20%24searchapp%20%3CBR%20%2F%3E%3CSTRONG%3E%20%3CEM%3E%20NOTE%3A%20%3C%2FEM%3E%20%3C%2FSTRONG%3E%20%3CEM%3E%20The%20Propset%20GUID%2C%20BCC9619B-BFBD-4BD6-8E51-466F9241A27A%2C%20is%20hardcoded%20in%20the%20file%20XmlDocumentNamingContainer.cs%20and%20should%20not%20be%20changed.%20%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ec.%20To%20specify%20that%20if%20there%20are%20unknown%20properties%20in%20the%20newly%20created%20crawled%20property%20category%2C%20these%20should%20be%20discovered%20during%20crawl%2C%20at%20the%20command%20prompt%2C%20type%20and%20run%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%3CBR%20%2F%3E%3CP%3Ei.%20%24c%20%3D%20Get-SPEnterpriseSearchMetadataCategory%20-SearchApplication%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Eii.%20%24searchapp%20-Identity%20%22%3CCONNECTORNAME%3E%22%3C%2FCONNECTORNAME%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Eiii.%20%24c.DiscoverNewProperties%20%3D%20%24true%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Eiv.%20%24c.Update()%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%208.%20%3C%2FSTRONG%3E%20Place%20a%20copy%20of%20the%20sample%20data%20from%20C%3A%5CUsers%5Cadministrator.CONTOSO%5CDocuments%5CVisual%20Studio%202012%5CProjects%5CSearchSecuirtyTrimmerExample%5CProduct.xml%20in%20some%20other%20directory%20such%20as%20c%3A%5C%20XMLCATALOG.%20%3CSTRONG%3E%20%3CEM%3E%20Make%20sure%20the%20Search%20Service%20account%20has%20read%20permissions%20to%20this%20folder.%20%3C%2FEM%3E%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%209.%20%3C%2FSTRONG%3E%20%3CSTRONG%3E%20Create%20a%20Content%20Source%20for%20your%20Custom%20Connector%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ea.%20On%20the%20home%20page%20of%20the%20SharePoint%20Central%20Administration%20website%2C%20in%20the%20Application%20Management%20section%2C%20choose%20Manage%20service%20applications.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eb.%20On%20the%20Manage%20Service%20Applications%20page%2C%20choose%20Search%20service%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ec.%20On%20the%20Search%20Service%20Administration%20Page%2C%20in%20the%20Crawling%20section%2C%20choose%20Content%20Sources.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ed.%20On%20the%20Manage%20Content%20Sources%20page%2C%20choose%20New%20Content%20Source.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ee.%20On%20the%20Add%20Content%20Source%20page%2C%20in%20the%20Name%20section%2C%20in%20the%20Name%20box%2C%20type%20a%20name%20for%20the%20new%20content%20source%2C%20for%20example%20XML%20Connector.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ef.%20In%20the%20Content%20Source%20Type%20section%2C%20select%20Custom%20repository.%20In%20the%20Type%20of%20Repository%20section%2C%20select%20xmldoc.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eg.%20In%20the%20Start%20Address%20section%2C%20in%20the%20Type%20start%20addresses%20below%20(one%20per%20line)%20box%2C%20type%20the%20address%20from%20where%20the%20crawler%20should%20being%20crawling%20the%20XML%20content.%20The%20start%20address%20syntax%20is%20different%20depending%20on%20where%20the%20XML%20content%20is%20located.%20Following%20the%20example%20so%20far%20you%20would%20put%20this%20value%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Exmldoc%3A%2F%2Flocalhost%2FC%24%2Fxmlcatalog%2F%23x%3DProduct%3AID%3B%3Btitleelm%3DTitle%3B%3Burlelm%3DUrl%23%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20syntax%20is%20different%20if%20you%20have%20the%20data%20source%20directory%20on%20the%20local%20machine%20versus%20on%20a%20network%20share.%20If%20the%20data%20source%20directory%20is%20local%2C%20use%20the%20following%20syntax%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Exmldoc%3A%2F%2Flocalhost%2FC%24%2F%3CCONTENTFOLDER%3E%2F%23x%3Ddoc%3Aid%3B%3Burielm%3Durl%3B%3Btitleelm%3Dtitle%23%3C%2FCONTENTFOLDER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20the%20data%20source%20directory%20is%20on%20a%20network%20drive%2C%20use%20the%20following%20syntax%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Exmldoc%3A%2F%2F%3CSHAREDNETWORKPATH%3E%2F%23x%3Ddoc%3Aid%3B%3Burielm%3Durl%3B%3Btitleelm%3Dtitle%23%3C%2FSHAREDNETWORKPATH%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20%22xmldoc%22%20is%20the%20name%20of%20name%20of%20the%20protocol%20of%20this%20connector%20as%20registered%20in%20the%20Registry%20when%20installing%20this%20connector.%20%3CEM%3ESee%20step%203%20above%20%3C%2FEM%3E%20.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20%22%2F%2F%3CLOCALHOST%3E%2Fc%24%2F%3CCONTENTFOLDER%3E%2F%22%20or%20%E2%80%9C%2F%2F%3CSHARENAME%3E%2F%3CCONTENTFOLDER%3E%2F%E2%80%9D%20is%20the%20full%20path%20to%20directory%20holding%20our%20xml%20files%20that%20are%20to%20be%20crawled%3C%2FCONTENTFOLDER%3E%3C%2FSHARENAME%3E%3C%2FCONTENTFOLDER%3E%3C%2FLOCALHOST%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20%22%23x%3D%3Adoc%3Aurl%3B%3Burielm%3Durl%3B%3Btitleelm%3Dtitle%23%22%20is%20a%20special%20way%20to%20encode%20config%20parameters%20used%20by%20the%20connector%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eo%20%22x%3D%3Adoc%3Aurl%22%20is%20the%20path%20of%20element%20in%20the%20xml%20document%20that%20specifies%20the%20id%20of%20a%20single%20item%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eo%20%3CSTRONG%3E%20%22urielm%3Durl%22%20%3C%2FSTRONG%3E%20is%20the%20name%20of%20the%20element%20in%20the%20xml%20document%20that%20will%20be%20set%20as%20the%20uri%20of%20the%20crawled%20item%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eo%20%3CSTRONG%3E%20%22titleelm%3Dtitle%22%20%3C%2FSTRONG%3E%20is%20the%20name%20of%20the%20element%20in%20the%20xml%20document%20that%20will%20be%20set%20as%20the%20title%20of%20the%20crawled%20item%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20Note%20that%20the%20separator%20is%20%E2%80%9C%3B%3B%E2%80%9D%20and%20that%20the%20set%20of%20properties%20are%20delineated%20with%20%E2%80%9C%23%E2%80%9D%20at%20the%20beginning%20and%20%E2%80%9C%23%E2%80%9D%20at%20the%20end.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EParts%20of%20the%20Connector%20Having%20to%20do%20with%20Claims-based%20Security%3C%2FP%3E%0A%3CP%3EIf%20you%E2%80%99ve%20looked%20at%20the%20BCS%20model%20schema%20before%20you%20know%20that%20in%20the%20Methods%20collection%20of%20the%20Entity%20element%20you%20usually%20specify%20a%20Finder%20and%20a%20%E2%80%9CSpecificFinder%E2%80%9D%20stereotyped%20method.%20In%20this%20example%20the%20Model%20is%20not%20used%20for%20External%20Lists%20or%20a%20Business%20Data%20List%20Web%20Part.%20It%20does%20not%20create%20or%20update%20items.%20Therefore%2C%20it%20specifies%20an%20AssociationNavigator%20method%20instead%2C%20which%20is%20easier%20to%20implement%20and%20is%20good%20in%20this%20example%20because%20it%20lets%20us%20focus%20more%20on%20the%20Security%20Trimming%20part.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAlso%2C%20this%20connector%20doesn%E2%80%99t%20provide%20for%20much%20functionality%20at%20the%20folder%20level%2C%20so%20we%E2%80%99ll%20concentrate%20primarily%20on%20the%20XmlDocument%20Entity%20and%20ignore%20the%20Folder%20entity.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EThe%20Model%3C%2FP%3E%0A%3CP%3EIn%20both%20the%20AssociationNavigator%20(or%20Finder)%20method%20definition%20and%20the%20SpecificFinder%20method%20definition%20we%20must%20specify%20a%20security%20descriptor%20but%20in%20this%20case%20we%20need%20to%20specify%20two%20other%20Type%20Descriptors.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CTYPEDESCRIPTOR%20name%3D%22%26quot%3BUsesPluggableAuth%26quot%3B%22%20typename%3D%22%26quot%3BSystem.Boolean%26quot%3B%22%3E%3C%2FTYPEDESCRIPTOR%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CTYPEDESCRIPTOR%20name%3D%22%26quot%3BSecurityDescriptor%26quot%3B%22%20typename%3D%22%26quot%3BSystem.Byte%5B%5D%26quot%3B%22%20iscollection%3D%22%26quot%3Btrue%26quot%3B%22%3E%3C%2FTYPEDESCRIPTOR%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CTYPEDESCRIPTORS%3E%3C%2FTYPEDESCRIPTORS%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CTYPEDESCRIPTOR%20name%3D%22%26quot%3BItem%26quot%3B%22%20typename%3D%22%26quot%3BSystem.Byte%26quot%3B%22%3E%3C%2FTYPEDESCRIPTOR%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CTYPEDESCRIPTOR%20name%3D%22%26quot%3Bdocaclmeta%26quot%3B%22%20typename%3D%22%26quot%3BSystem.String%2C%22%20mscorlib%3D%22%22%3E%3C%2FTYPEDESCRIPTOR%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20Method%20Instance%20definition%20we%20tell%20BCS%20what%20the%20names%20of%20these%20field%20type%20will%20be%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BUsesPluggableAuthentication%26quot%3B%22%3EUsesPluggableAuth%3C%2FPROPERTY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BWindowsSecurityDescriptorField%26quot%3B%22%20type%3D%22%26quot%3BSystem.String%26quot%3B%22%3ESecurityDescriptor%3C%2FPROPERTY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPROPERTY%20name%3D%22%26quot%3BDocaclmetaField%26quot%3B%22%20type%3D%22%26quot%3BSystem.String%26quot%3B%22%3Edocaclmeta%3C%2FPROPERTY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20UsesPluggableAuth%20as%20a%20boolean%20field%20type%20%3CEM%3E%20.%20If%20the%20value%20of%20this%20field%20is%20true%2C%20then%20we%E2%80%99re%20telling%20BCS%20to%20use%20custom%20security%20claims%20instead%20of%20the%20Windows%20Security%20descriptors.%20%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20SecurityDescriptor%20as%20a%20byte%20array%20for%20the%20actual%20encoded%20claims%20data%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20docaclmeta%20as%20an%20optional%20string%20field%2C%20which%20will%20only%20be%20displayed%20in%20the%20search%20results%20if%20populated.%20This%20field%20is%20not%20queryable%20in%20the%20index.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EXmlFileLoader%20Class%3C%2FP%3E%0A%3CP%3EIn%20the%20connector%20code%20the%20XmlFileLoader%20utility%20class%20populates%20these%20values%20into%20the%20document%20that%20is%20returned%20to%20the%20index.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20some%20case%20we%20use%20logic%20to%20determine%20the%20value%20as%20here%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUsesPluggableAuth%20%3Dsecurity%20!%3Dnull%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20XmlFileLoader%20class%20also%20encodes%20the%20claim.%20Claims%20are%20encoded%20as%20a%20binary%20byte%20stream.%20The%20data%20type%20of%20this%20example%20is%20always%20of%20type%20string%20but%20this%20is%20not%20a%20requirement%20of%20the%20SharePoint%20backend.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20claims%20are%20encoded%20in%20the%20AddClaimAcl%20method%20according%20to%20these%20rules%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20first%20byte%20signals%20an%20allow%20or%20deny%20claim%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20second%20byte%20is%20always%201%20to%20indicate%20that%20this%20is%20a%20non-NT%20security%20ACL%20(i.e.%20it%20is%20a%20claim%20ACL%20type)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20next%20four%20bytes%20is%20the%20size%20of%20the%20following%20claim%20value%20array%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20claim%20value%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20value%20array%2C%20gives%20the%20length%20of%20the%20claim%20type%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20claim%20type%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20type%20array%2C%20gives%20the%20length%20of%20the%20claim%20data%20type%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20claim%20data%20type%20string%20follows%20as%20a%20Unicode%20byte%20array%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20next%20four%20bytes%20following%20the%20claim%20data%20type%20array%2C%20gives%20the%20length%20of%20the%20claim%20original%20issuer%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%C2%B7%20The%20claim%20issuer%20string%20finally%20follows%20as%20a%20Unicode%20byte%20array.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EEntity%20Class%3C%2FP%3E%0A%3CP%3ENaturally%2C%20we%20have%20to%20include%20the%20three%20security-related%20fields%20in%20the%20Entity%20that%20is%20returned%20by%20the%20connector%3A%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3Epublic%20class%20Document%20%3CBR%20%2F%3E%7B%20%3CBR%20%2F%3Eprivate%20DateTime%20lastModifiedTime%20%3D%20DateTime.Now%3B%20%3CBR%20%2F%3E%3CBR%20%2F%3Epublic%20string%20Title%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20string%20DocumentID%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20string%20Url%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20DateTime%20LastModifiedTime%20%7B%20get%20%7B%20return%20this.lastModifiedTime%3B%20%7D%20set%20%7B%20this.lastModifiedTime%20%3D%20value%3B%20%7D%20%7D%20%3CBR%20%2F%3Epublic%20DocumentProperty%5B%5D%20DocumentProperties%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%2F%2F%20Security%20Begin%20%3CBR%20%2F%3Epublic%20Byte%5B%5D%20SecurityDescriptor%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20Boolean%20UsesPluggableAuth%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3Epublic%20string%20docaclmeta%20%7B%20get%3B%20set%3B%20%7D%20%3CBR%20%2F%3E%2F%2F%20Security%20End%20%3CBR%20%2F%3E%7D%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--983970762%22%20id%3D%22toc-hId-1692303282%22%20id%3D%22toc-hId-1692303282%22%20id%3D%22toc-hId-1692303282%22%20id%3D%22toc-hId-1692303282%22%20id%3D%22toc-hId-1692303282%22%20id%3D%22toc-hId-1692303282%22%20id%3D%22toc-hId-1692303282%22%3EProducts.xml%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20example%20all%20the%20documents%20are%20returned%20from%20one%20XML%20file%2C%20but%20here%20is%20one%20Product%20from%20that%20file%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CPRODUCT%3E%3C%2FPRODUCT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CID%3E1%3C%2FID%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CURL%3Ehttp%3A%2F%2Fwfe%2Fsite%2Fcatalog%2Fitem1%3C%2FURL%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CTITLE%3EAdventure%20Works%20Laptop15.4W%20M1548%20White%3C%2FTITLE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CITEM_X0020_NUMBER%3E1010101%3C%2FITEM_X0020_NUMBER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CGROUP_X0020_NUMBER%3E10101%3C%2FGROUP_X0020_NUMBER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CITEMCATEGORYNUMBER%3E101%3C%2FITEMCATEGORYNUMBER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CITEMCATEGORYTEXT%3ELaptops%3C%2FITEMCATEGORYTEXT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CABOUT%3ELaptop%20with%20640%20GB%20hard%20drive%20and%204%20GB%20RAM.%2015.4-inch%20widescreen%20TFT%20LED%20display.%203%20high-speed%20USB%20ports.%20Built-in%20webcam%20and%20DVD%2FCD-RW%20drive.%20%3C%2FABOUT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CUNITPRICE%3E%24758%2C00%3C%2FUNITPRICE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBRAND%3EAdventure%20Works%3C%2FBRAND%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCOLOR%3EWhite%3C%2FCOLOR%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CWEIGHT%3E3.2%3C%2FWEIGHT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSCREENSIZE%3E15.4%3C%2FSCREENSIZE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CMEMORY%3E1000%3C%2FMEMORY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CHARDDRIVE%3E160%3C%2FHARDDRIVE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCAMPAIGN%3E0%3C%2FCAMPAIGN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CONSALE%3E1%3C%2FONSALE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CDISCOUNT%3E-0.2%3C%2FDISCOUNT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CLANGUAGE_X0020_TAG%3Een-US%3C%2FLANGUAGE_X0020_TAG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C!--%20Security%20Begin%20--%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCLAIMTYPE%3E%3CA%20href%3D%22http%3A%2F%2Fsurface.microsoft.com%2Fsecurity%2Facl%26lt%3B%2Fclaimtype%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fsurface.microsoft.com%2Fsecurity%2Facl%3C%2FA%3E%3C%2FCLAIMTYPE%3E%26gt%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCLAIMVALUE%3Euser1%3C%2FCLAIMVALUE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCLAIMISSUER%3Ecustomtrimmer%3C%2FCLAIMISSUER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CCLAIMACLMETA%3Eaccess%3C%2FCLAIMACLMETA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C!--%20Security%20End%C2%A0%C2%A0%20--%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote%20that%20the%20last%204%20elements%20specify%20the%20claim%20value%20that%20will%20be%20evaluated%20by%20the%20Security%20Descriptor%20member%20that%20is%20returned%20in%20the%20Entity.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-758839573%22%20id%3D%22toc-hId--859853679%22%20id%3D%22toc-hId--859853679%22%20id%3D%22toc-hId--859853679%22%20id%3D%22toc-hId--859853679%22%20id%3D%22toc-hId--859853679%22%20id%3D%22toc-hId--859853679%22%20id%3D%22toc-hId--859853679%22%3ECustom%20Security%20Pre-Trimmer%20Implementation%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20new%20pre-trimmer%20type%20is%20where%20the%20trimmer%20logic%20is%20invoked%20pre-query%20evaluation.%20The%20search%20server%20backend%20rewrites%20the%20query%20adding%20security%20information%20before%20the%20index%20lookup%20in%20the%20search%20index.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBecause%20the%20data%20source%20contains%20information%20about%20the%20claims%20that%20are%20accepted%2C%20the%20lookup%20can%20return%20only%20the%20appropriate%20results%20that%20satisfy%20the%20claim%20demand.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Benefits%20of%20Pre-Trimming%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPre-trimming%20has%20better%20performance%20metrics%20so%20that%20is%20the%20method%20that%20is%20most%20recommended.%20Besides%20that%20the%20new%20Framework%20makes%20it%20easy%20to%20specify%20simple%20claims%20(in%20the%20form%20of%20strings)%20instead%20of%20having%20to%20encode%20ACLs%20in%20the%20form%20of%20Byte%20Arrays%20in%20the%20data%20source%20(something%20which%20can%20be%20quite%20time%20consuming%20and%20difficult).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20create%20a%20custom%20security%20pre-trimmer%20we%20must%20implement%20the%20two%20methods%20of%20ISecurityTrimmerPre.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIEnumerable%3CTUPLE%3E%3CMICROSOFT.IDENTITYMODEL.CLAIMS.CLAIM%3E%26gt%3B%20AddAccess(IDictionary%3CSTRING%3E%20sessionProperties%2C%20IIdentityuserIdentity)%3B%3C%2FSTRING%3E%3C%2FMICROSOFT.IDENTITYMODEL.CLAIMS.CLAIM%3E%3C%2FTUPLE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Evoid%20Initialize(NameValueCollection%20staticProperties%2C%20SearchServiceApplication%20searchApplication)%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EThe%20Membership%20Data%20(DataFile.txt)%3C%2FP%3E%0A%3CP%3EIn%20the%20beginning%20of%20the%20SearchPreTrimmer%20class%20I%20set%20the%20path%20to%20the%20datafile.txt%20membership%20file%20to%20%40%22c%3A%5Cmembership%5Cdatafile.txt%22.%20You%E2%80%99ll%20need%20to%20either%20change%20that%20or%20put%20your%20membership%20file%20there.%20The%20included%20example%20is%20basically%20blank%20but%20here%20is%20what%20mine%20looks%20like%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20domain%5Cusername%3Auser1%3Buser3%3Buser2%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20contoso%5Caaronp%3Auser1%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20contoso%5Cadamb%3Auser2%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20contoso%5Cadambu%3Auser1%3Buser2%3Buser3%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20contoso%5Calanb%3Auser3%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20identity%20of%20the%20user%20is%20the%20first%20thing%20on%20every%20line%20and%20then%20comes%20a%20colon.%20After%20that%20is%20a%20list%20of%20claims%2C%20separated%20by%20semicolons.%20I%20left%20the%20user1%2C%20user2%2C%20user3%20claims%2C%20but%20you%20could%20make%20it%20%E2%80%9Ceditor%E2%80%9D%2C%20%E2%80%9Capprover%E2%80%9D%2C%20%E2%80%9Cmajordomo%E2%80%9D%20or%20whatever%20group%20claims%20make%20sense%20to%20you.%20You%20don%E2%80%99t%20have%20to%20think%20of%20it%20as%20groups%2C%20it%20just%20a%20string%20claim.%20The%20data%20that%20is%20crawled%20by%20the%20connector%20will%20specify%20the%20list%20of%20claims%20that%20can%20view%20that%20item%20in%20the%20search%20results.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EInitialize%3C%2FP%3E%0A%3CP%3EThe%20main%20thing%20you%E2%80%99ll%20be%20doing%20in%20Initialize%20is%20setting%20the%20values%20of%20claim%20type%2C%20the%20claim%20issuer%20and%20the%20path%20to%20the%20datafile.%20The%20claim%20type%20and%20claim%20issuer%20are%20very%20important%20because%20the%20trimmer%20will%20use%20this%20information%20to%20determine%20whether%20and%20how%20to%20apply%20the%20demands%20for%20claims.%20The%20path%20to%20the%20data%20file%20is%20important%20because%20that%20is%20where%20the%20membership%20is%20specified.%20You%20can%20think%20of%20it%20as%20a%20membership%20provider%20just%20for%20the%20specific%20claims%20that%20you%20want%20to%20inject%20for%20the%20purposes%20of%20your%20custom%20trimming.%20It%20The%20framework%20passes%20in%20a%20NameValueCollection%20and%20it%E2%80%99s%20possible%20values%20could%20be%20sent%20in%20from%20there.%20You%20will%20probably%20want%20to%20set%20default%20values%20as%20we%20do%20in%20the%20example.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAddAccess%3C%2FP%3E%0A%3CP%3EThe%20AddAccess%20method%20of%20the%20trimmer%20is%20responsible%20for%20returning%20claims%20to%20be%20added%20to%20the%20query%20tree.%20The%20method%20has%20to%20return%20an%20IEnumerable%3CTUPLE%3E%3CCLAIM%3E%26gt%3B%20but%20a%20Linked%20List%20is%20appropriate%20because%20it%20orders%20the%20claims%20in%20the%20same%20order%20that%20they%20were%20added%20in%20the%20datafile.%3C%2FCLAIM%3E%3C%2FTUPLE%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20group%20membership%20data%20is%20refreshed%20every%2030%20seconds%20which%20is%20specified%20in%20the%20RefreshDataFile%20method.%20RefreshDataFile%20uses%20a%20utility%20wrapper%20class%20(Lookup)%20to%20load%20the%20membership%20data%20into%20a%20simple%20to%20use%20collection.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20framework%20calls%20AddAccess%20passing%20in%20the%20identity%20with%20the%20claims%20we%20attached%20in%20the%20datafile%20specified%20in%20Initialize.%20Then%20we%20loop%20through%20those%20claims%20and%20add%20them%20to%20the%20IEnumerable%20of%20claims%20that%20AddAccess%20returns.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EInstalling%20and%20Debugging%20the%20Pre-Trimmer%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ETo%20register%20the%20custom%20trimmer%20%3C%2FSTRONG%3E%20%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENew-SPEnterpriseSearchSecurityTrimmer%20-SearchApplication%20%22Search%20Service%20Application%22%20%3CBR%20%2F%3E-typeName%20%22CstSearchPreTrimmer.SearchPreTrimmer%2C%20CstSearchPreTrimmer%2CVersion%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dtoken%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-id%201%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Enet%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Enet%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20%E2%80%93id%20parameter%20is%20just%20an%20index%20in%20the%20collection.%20I%20think%20it%E2%80%99s%20arbitrary.%20I%20had%20to%20put%20a%20value%20though.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20To%20debug%20the%20pre-trimmer%20code%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20may%20not%20need%20to%20do%20this%20and%20you%20won%E2%80%99t%20want%20to%20do%20it%20too%20often%2C%20but%20if%20you%20have%20complex%20logic%20in%20any%20of%20the%20code%20that%20retrieves%20or%20sets%20the%20static%20properties%20of%20the%20trimmer%2C%20you%20may%20want%20to%20debug%20the%20code.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20had%20to%20do%20the%20following%20things.%20I%E2%80%99m%20really%20not%20sure%20if%20all%20of%20them%20are%20necessary%2C%20but%20I%20could%20not%20break%20in%20without%20doing%20all%20of%20them%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1)%20Build%20and%20GAC%20the%20debug%20version%20of%20the%20SearchPreTrimmer%20to%20make%20sure%20you%20have%20the%20same%20version%20installed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2)%20Remove%20the%20Security%20Trimmer%20with%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%24searchapp%20%3D%20Get-SPEnterpriseSearchServiceApplication%20-Identity%20%22Search%20Service%20Application%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERemove-SPEnterpriseSearchSecurityTrimmer%20-SearchApplication%20%24searchapp%20-Identity%201%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3)%20Restart%20the%20Search%20Service%20Host.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ea.%20net%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eb.%20net%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E4)%20IIS%20Reset.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E5)%20Re-register%20the%20security%20trimmer%20using%20register%20script%20above.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E6)%20Restart%20the%20Search%20Service%20Host.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ea.%20net%20stop%20%22SharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eb.%20net%20start%20%E2%80%9CSharePoint%20Search%20Host%20Controller%E2%80%9D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E7)%20Use%20appcmd%20list%20wp%20to%20get%20the%20correct%20Worker%20Process%20ID%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E8)%3C%2Fimg%3E%20Attach%20to%20the%20correct%20w3wp.exe%20and%20all%20noderunner.exe%20instances%20(not%20sure%20if%20there%E2%80%99s%20a%20way%20to%20get%20the%20correct%20instance%20or%20not).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E9)%20Start%20start%20a%20Search%20using%20and%20%3CSTRONG%3E%20Enterprise%20Search%20Center%20Site%20Collection.%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20got%20frequent%20problems%20like%20time%20outs%20and%20I%20always%20had%20to%20start%20the%20search%20on%20the%20same%20login%20account%20as%20Visual%20Studio%20was%20running%20in.%20Nevertheless%20it%20was%20possible%20and%20I%20did%20it%20more%20than%20once%20with%20the%20same%20steps%20as%20above.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EConclusion%3C%2FP%3E%0A%3CP%3EWe%E2%80%99ve%20covered%20the%20basics%20of%20how%20claims%20are%20sent%20to%20SharePoint%20in%20the%20customer%20connector.%20We%20covered%20the%20basics%20of%20the%20custom%20Security%20Pre-Trimmer%20in%20SharePoint%202013%20and%20how%20it%20can%20use%20the%20claims%20sent%20by%20the%20custom%20connector%20to%20let%20the%20Query%20Engine%20specify%20claims-based%20ACLs%20so%20that%20only%20relevant%20result%20are%20returned%20to%20the%20results%20page.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FTNBlogsFS%2Fprod.evol.blogs.technet.com%2Ftelligent.evolution.components.attachments%2F01%2F9350%2F00%2F00%2F03%2F57%2F52%2F17%2FSearchSecuirtyTrimmerExample.zip%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20SearchSecuirtyTrimmerExample.zip%20%3C%2FA%3E%3C%2FP%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-509801%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20published%20on%20TECHNET%20on%20May%2028%2C%202013%20This%20post%20is%20a%20contribution%20from%20Adam%20Burns%2C%20an%20engineer%20with%20the%20SharePoint%20Developer%20Support%20team.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-509801%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1880919%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20a%20Custom%20Security%20Pre-Trimmer%20with%20Claims%20in%20SharePoint%202013%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1880919%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20Thanks%20for%20writing%20this%20blog.%20I%20implemented%20all%20above%20steps%20in%20SharePoint%202019%20and%20tried%20to%20crawl%20the%20XML%20data.%20I%20am%20getting%20error%20while%20crawling.%26nbsp%3B%3CSTRONG%3E%E2%80%9CError%20while%20crawling%20LOB%20contents.%20(%20Error%20caused%20by%20exception%3A%20Microsoft.SharePoint.BusinessData.Parser.PackageFormatException%20DotNetAssembly%2FWebService%2FCustom%20system%20type%20is%20not%20supported%20in%20FileBackedMetadaCatalog.%E2%80%9D%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20let%20me%20know%20if%20this%20solution%20is%20feasible%20in%20SharePoint%202019.%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F330652%22%20target%3D%22_blank%22%3E%40SPDev_Support%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1906559%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20a%20Custom%20Security%20Pre-Trimmer%20with%20Claims%20in%20SharePoint%202013%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1906559%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20facing%20the%20same%20issue%20with%20a%20former%20working%20connector%20since%20security%20update%20SP%202016%20(KB4484512%2C%26nbsp%3B%3CSPAN%3EKB4484506).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F330652%22%20target%3D%22_blank%22%3E%40SPDev_Support%3C%2FA%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1932827%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20a%20Custom%20Security%20Pre-Trimmer%20with%20Claims%20in%20SharePoint%202013%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1932827%22%20slang%3D%22en-US%22%3E%3CP%3EUnfortunately%20we%20have%20not%20tested%20in%20SP2016%20or%20SP2019%20and%20doubt%20this%20will%20work%20in%20SP2016%20or%20SP2019.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1933260%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20a%20Custom%20Security%20Pre-Trimmer%20with%20Claims%20in%20SharePoint%202013%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1933260%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20opened%20a%20support%20ticket%20with%20Microsoft.%20The%20result%20is%20that%20it%20is%20a%20bug%20that%20will%20most%20likely%20be%20fixed%20with%20the%20coming%20CU.%20Anyway%2C%20I%20got%20a%20not%20yet%20released%20update%20package%2C%20so%20everything%20is%20working%20again%20%3B)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936101%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20a%20Custom%20Security%20Pre-Trimmer%20with%20Claims%20in%20SharePoint%202013%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936101%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F8727%22%20target%3D%22_blank%22%3E%40Boris%20Hofmann%3C%2FA%3E%26nbsp%3B%20%26amp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F330652%22%20target%3D%22_blank%22%3E%40SPDev_Support%3C%2FA%3E%26nbsp%3B%20for%20your%20response.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F8727%22%20target%3D%22_blank%22%3E%40Boris%20Hofmann%3C%2FA%3E%26nbsp%3BReally%20glad%20to%20know%20that%20it%20worked%20for%20you.%20We%20also%20have%20a%20support%20ticket%20open%20with%20Microsoft.%20Can%20you%20please%20share%20the%20KB%20number%20or%20name%20of%20the%20package%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20We%20are%20going%20to%20crawl%20the%20data%20from%20SQL%20DB.%20Will%20it%20work%20with%20SQL%20as%20well%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936105%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20a%20Custom%20Security%20Pre-Trimmer%20with%20Claims%20in%20SharePoint%202013%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936105%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F866879%22%20target%3D%22_blank%22%3E%40saketm89%3C%2FA%3E%26nbsp%3BI%20guess%20it%20is%20kb4462233%20the%20file%20was%20named%20(sts2016-kb4462233-fullfile-x64-glb.exe)%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

First published on TECHNET on May 28, 2013

This post is a contribution from Adam Burns, an engineer with the SharePoint Developer Support team.

 

This post repackages examples that are already out there on MSDN, but brings two examples together and provides some implementation details that may not be obvious in the existing articles. I also tried to leave out confusing details that didn’t bear directly on the subject of using custom claims to do Pre-Trimming of search results. In general you should look at the included sample code after reading the description of the different parts and that should be enough to understand the concepts.


What you will learn:

    • We will review basic concept of a custom Indexing Connector because we will have to implement a connector in order to demonstrate the capabilities of the new Security Trimmer Framework.

 

    • We’ll cover how a connector can provide Claims to the Indexer and how the Security Trimmer can use those Claims to provide a very flexibly way to trim and customize search results.

 

    • We’ll quickly cover the different between a pre- and post- trimmer but we’ll only implement the pre-trimmer.



Sample Code:

The sample code includes two projects, the Custom Indexing Connector (XmlFileConnector) which sends claims to BCS, and the SearchPreTrimmer project which actually implements the trimming. In addition you’ll find:



    • Products.xml - a sample external data file for crawling.

 

    • Xmldoc.reg - to set the proper registry value so that the custom protocol is handled by the connector.

 

    • Datafile.txt – a sample membership data file. This is where the claims for each user are specified.



The Connector

 

We’ll use the XmlFileConnector. One of the good things about this kind of connector is that you can use it for a database. For instance it can be a product catalog, a navigation source, etc.

 

To install the connector do the below steps (All paths are examples and can easily be substituted for applicable paths:

 

1. Build the included XmlFileConnector project.

 

2. Open the “ Developer Command Prompt for Visual Studio 2012 ” and type:

 

 

3. Merge the registry entries for the protocol handler by double-clicking on the registry file located at “C:\Users\administrator.CONTOSO\Documents\Visual Studio 2012\Projects\SearchSecuirtyTrimmerExample\XmlFileConnector\xmldoc.reg”. That’s the protocol handler part of all this. Unless SharePoint knows about the protocol you are registering the connector won’t work. Registering the custom protocol is a requirement for custom indexing connectors in SharePoint.

 

4. Open “ SharePoint 2103 Management Shell ” and type:

 

 

5. You can check the success like this:

 

Get-SPEnterpriseSearchCrawlCustomConnector -SearchApplication $searchapp | ft -Wrap

 

You should get:

 

 

 

 

6. Stop and Start the Search Service

 

 

7. Create a Crawled Property Category .

 

When the custom indexing connector crawls content the properties discovered and indexed will have to be assigned to a Crawled Property Connector. You will associate the category with the Connector.

 

Later on, if you want to have Navigation by Search or Content By Search, you will want to create a managed property and map it to one of the custom properties in this Crawled Property Category. This will allow to present content using Managed Navigation and the Content Search Web Part (note that Content Search Web Part is not present in SharePoint Online yet, but it is coming in the future).

 

To create a new crawled property category, open SharePoint 2013 Management Shell and type the following commands and run them,

 

a. $searchapp = Get-SPEnterpriseSearchServiceApplication -Identity "<YourSearchServiceName>"

 

b. New-SPEnterpriseSearchMetadataCategory -Name "XmlFileConnector" -Propset "BCC9619B-BFBD-4BD6-8E51-466F9241A27A" -searchApplication $searchapp
NOTE: The Propset GUID, BCC9619B-BFBD-4BD6-8E51-466F9241A27A, is hardcoded in the file XmlDocumentNamingContainer.cs and should not be changed.

 

c. To specify that if there are unknown properties in the newly created crawled property category, these should be discovered during crawl, at the command prompt, type and run the following:

 


i. $c = Get-SPEnterpriseSearchMetadataCategory -SearchApplication


ii. $searchapp -Identity "<ConnectorName>"


iii. $c.DiscoverNewProperties = $true


iv. $c.Update()

 

8. Place a copy of the sample data from C:\Users\administrator.CONTOSO\Documents\Visual Studio 2012\Projects\SearchSecuirtyTrimmerExample\Product.xml in some other directory such as c:\ XMLCATALOG. Make sure the Search Service account has read permissions to this folder.

 

9. Create a Content Source for your Custom Connector:

 

a. On the home page of the SharePoint Central Administration website, in the Application Management section, choose Manage service applications.

 

b. On the Manage Service Applications page, choose Search service application.

 

c. On the Search Service Administration Page, in the Crawling section, choose Content Sources.

 

d. On the Manage Content Sources page, choose New Content Source.

 

e. On the Add Content Source page, in the Name section, in the Name box, type a name for the new content source, for example XML Connector.

 

f. In the Content Source Type section, select Custom repository. In the Type of Repository section, select xmldoc.

 

g. In the Start Address section, in the Type start addresses below (one per line) box, type the address from where the crawler should being crawling the XML content. The start address syntax is different depending on where the XML content is located. Following the example so far you would put this value:

 

xmldoc://localhost/C$/xmlcatalog/#x=Product:ID;;titleelm=Title;;urlelm=Url#

 

The syntax is different if you have the data source directory on the local machine versus on a network share. If the data source directory is local, use the following syntax:

 

xmldoc://localhost/C$/<contentfolder>/#x=doc:id;;urielm=url;;titleelm=title#

 

If the data source directory is on a network drive, use the following syntax:

 

xmldoc://<SharedNetworkPath>/#x=doc:id;;urielm=url;;titleelm=title#

 

· "xmldoc" is the name of name of the protocol of this connector as registered in the Registry when installing this connector. See step 3 above .

 

· "//<localhost>/c$/<contentfolder>/" or “//<ShareName>/<contentfolder>/” is the full path to directory holding our xml files that are to be crawled

 

· "#x=:doc:url;;urielm=url;;titleelm=title#" is a special way to encode config parameters used by the connector

 

o "x=:doc:url" is the path of element in the xml document that specifies the id of a single item

 

o "urielm=url" is the name of the element in the xml document that will be set as the uri of the crawled item

 

o "titleelm=title" is the name of the element in the xml document that will be set as the title of the crawled item

 

· Note that the separator is “;;” and that the set of properties are delineated with “#” at the beginning and “#” at the end.

 

 


Parts of the Connector Having to do with Claims-based Security

If you’ve looked at the BCS model schema before you know that in the Methods collection of the Entity element you usually specify a Finder and a “SpecificFinder” stereotyped method. In this example the Model is not used for External Lists or a Business Data List Web Part. It does not create or update items. Therefore, it specifies an AssociationNavigator method instead, which is easier to implement and is good in this example because it lets us focus more on the Security Trimming part.

 

Also, this connector doesn’t provide for much functionality at the folder level, so we’ll concentrate primarily on the XmlDocument Entity and ignore the Folder entity.


The Model

In both the AssociationNavigator (or Finder) method definition and the SpecificFinder method definition we must specify a security descriptor but in this case we need to specify two other Type Descriptors.

 

<TypeDescriptor Name="UsesPluggableAuth" TypeName="System.Boolean" />

 

<TypeDescriptor Name="SecurityDescriptor" TypeName="System.Byte[]" IsCollection="true">

 

<TypeDescriptors>

 

<TypeDescriptor Name="Item" TypeName="System.Byte" />

 

</TypeDescriptors>

 

</TypeDescriptor>

 

<TypeDescriptor Name="docaclmeta" TypeName="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

 

 

 

In the Method Instance definition we tell BCS what the names of these field type will be:

 

<Property Name="UsesPluggableAuthentication"     Type="System.String">UsesPluggableAuth</Property>

 

<Property Name="WindowsSecurityDescriptorField" Type="System.String">SecurityDescriptor</Property>

 

<Property Name="DocaclmetaField" Type="System.String">docaclmeta</Property>

 

· UsesPluggableAuth as a boolean field type . If the value of this field is true, then we’re telling BCS to use custom security claims instead of the Windows Security descriptors.

 

· SecurityDescriptor as a byte array for the actual encoded claims data

 

· docaclmeta as an optional string field, which will only be displayed in the search results if populated. This field is not queryable in the index.


XmlFileLoader Class

In the connector code the XmlFileLoader utility class populates these values into the document that is returned to the index.

 

In some case we use logic to determine the value as here:

 

UsesPluggableAuth =security !=null,

 

 

 

The XmlFileLoader class also encodes the claim. Claims are encoded as a binary byte stream. The data type of this example is always of type string but this is not a requirement of the SharePoint backend.

 

The claims are encoded in the AddClaimAcl method according to these rules:

 

· The first byte signals an allow or deny claim

 

· The second byte is always 1 to indicate that this is a non-NT security ACL (i.e. it is a claim ACL type)

 

· The next four bytes is the size of the following claim value array

 

· The claim value string follows as a Unicode byte array

 

· The next four bytes following the claim value array, gives the length of the claim type

 

· The claim type string follows as a Unicode byte array

 

· The next four bytes following the claim type array, gives the length of the claim data type

 

· The claim data type string follows as a Unicode byte array

 

· The next four bytes following the claim data type array, gives the length of the claim original issuer

 

· The claim issuer string finally follows as a Unicode byte array.


Entity Class

Naturally, we have to include the three security-related fields in the Entity that is returned by the connector:


public class Document
{
private DateTime lastModifiedTime = DateTime.Now;

public string Title { get; set; }
public string DocumentID { get; set; }
public string Url { get; set; }
public DateTime LastModifiedTime { get { return this.lastModifiedTime; } set { this.lastModifiedTime = value; } }
public DocumentProperty[] DocumentProperties { get; set; }
// Security Begin
public Byte[] SecurityDescriptor { get; set; }
public Boolean UsesPluggableAuth { get; set; }
public string docaclmeta { get; set; }
// Security End
}

Products.xml

 

In the example all the documents are returned from one XML file, but here is one Product from that file:

 

<Product>

 

<ID>1</ID>

 

<Url>http://wfe/site/catalog/item1</Url>

 

<Title>Adventure Works Laptop15.4W M1548 White</Title>

 

<Item_x0020_Number>1010101</Item_x0020_Number>

 

<Group_x0020_Number>10101</Group_x0020_Number>

 

<ItemCategoryNumber>101</ItemCategoryNumber>

 

<ItemCategoryText>Laptops</ItemCategoryText>

 

<About>Laptop with 640 GB hard drive and 4 GB RAM. 15.4-inch widescreen TFT LED display. 3 high-speed USB ports. Built-in webcam and DVD/CD-RW drive. </About>

 

<UnitPrice>$758,00</UnitPrice>

 

<Brand>Adventure Works</Brand>

 

<Color>White</Color>

 

<Weight>3.2</Weight>

 

<ScreenSize>15.4</ScreenSize>

 

<Memory>1000</Memory>

 

<HardDrive>160</HardDrive>

 

<Campaign>0</Campaign>

 

<OnSale>1</OnSale>

 

<Discount>-0.2</Discount>

 

<Language_x0020_Tag>en-US</Language_x0020_Tag>

 

<!-- Security Begin -->

 

<claimtype>http://surface.microsoft.com/security/acl</claimtype>

 

<claimvalue>user1</claimvalue>

 

<claimissuer>customtrimmer</claimissuer>

 

<claimaclmeta>access</claimaclmeta>

 

<!-- Security End   -->

 

</Product>

 

 

 

Note that the last 4 elements specify the claim value that will be evaluated by the Security Descriptor member that is returned in the Entity.

 

Custom Security Pre-Trimmer Implementation

 

The new pre-trimmer type is where the trimmer logic is invoked pre-query evaluation. The search server backend rewrites the query adding security information before the index lookup in the search index.

 

Because the data source contains information about the claims that are accepted, the lookup can return only the appropriate results that satisfy the claim demand.

 

Benefits of Pre-Trimming

 

Pre-trimming has better performance metrics so that is the method that is most recommended. Besides that the new Framework makes it easy to specify simple claims (in the form of strings) instead of having to encode ACLs in the form of Byte Arrays in the data source (something which can be quite time consuming and difficult).

 

To create a custom security pre-trimmer we must implement the two methods of ISecurityTrimmerPre.

 

IEnumerable<Tuple<Microsoft.IdentityModel.Claims.Claim, bool>> AddAccess(IDictionary<string, object> sessionProperties, IIdentityuserIdentity);

 

void Initialize(NameValueCollection staticProperties, SearchServiceApplication searchApplication);

 

 


The Membership Data (DataFile.txt)

In the beginning of the SearchPreTrimmer class I set the path to the datafile.txt membership file to @"c:\membership\datafile.txt". You’ll need to either change that or put your membership file there. The included example is basically blank but here is what mine looks like;

 

domain\username:user1;user3;user2;

 

contoso\aaronp:user1;

 

contoso\adamb:user2;

 

contoso\adambu:user1;user2;user3

 

contoso\alanb:user3;

 

The identity of the user is the first thing on every line and then comes a colon. After that is a list of claims, separated by semicolons. I left the user1, user2, user3 claims, but you could make it “editor”, “approver”, “majordomo” or whatever group claims make sense to you. You don’t have to think of it as groups, it just a string claim. The data that is crawled by the connector will specify the list of claims that can view that item in the search results.


Initialize

The main thing you’ll be doing in Initialize is setting the values of claim type, the claim issuer and the path to the datafile. The claim type and claim issuer are very important because the trimmer will use this information to determine whether and how to apply the demands for claims. The path to the data file is important because that is where the membership is specified. You can think of it as a membership provider just for the specific claims that you want to inject for the purposes of your custom trimming. It The framework passes in a NameValueCollection and it’s possible values could be sent in from there. You will probably want to set default values as we do in the example.


AddAccess

The AddAccess method of the trimmer is responsible for returning claims to be added to the query tree. The method has to return an IEnumerable<Tuple<Claim, bool>> but a Linked List is appropriate because it orders the claims in the same order that they were added in the datafile.

 

The group membership data is refreshed every 30 seconds which is specified in the RefreshDataFile method. RefreshDataFile uses a utility wrapper class (Lookup) to load the membership data into a simple to use collection.

 

The framework calls AddAccess passing in the identity with the claims we attached in the datafile specified in Initialize. Then we loop through those claims and add them to the IEnumerable of claims that AddAccess returns.


Installing and Debugging the Pre-Trimmer

To register the custom trimmer :

 

New-SPEnterpriseSearchSecurityTrimmer -SearchApplication "Search Service Application"
-typeName "CstSearchPreTrimmer.SearchPreTrimmer, CstSearchPreTrimmer,Version=1.0.0.0, Culture=neutral, PublicKeyToken=token"

 

-id 1

 

net stop "SharePoint Search Host Controller”

 

net start “SharePoint Search Host Controller”

 

The –id parameter is just an index in the collection. I think it’s arbitrary. I had to put a value though.

 

To debug the pre-trimmer code:

 

You may not need to do this and you won’t want to do it too often, but if you have complex logic in any of the code that retrieves or sets the static properties of the trimmer, you may want to debug the code.

 

I had to do the following things. I’m really not sure if all of them are necessary, but I could not break in without doing all of them:

 

1) Build and GAC the debug version of the SearchPreTrimmer to make sure you have the same version installed.

 

2) Remove the Security Trimmer with:

 

$searchapp = Get-SPEnterpriseSearchServiceApplication -Identity "Search Service Application"

 

Remove-SPEnterpriseSearchSecurityTrimmer -SearchApplication $searchapp -Identity 1

 

3) Restart the Search Service Host.

 

a. net stop "SharePoint Search Host Controller”

 

b. net start “SharePoint Search Host Controller”

 

4) IIS Reset.

 

5) Re-register the security trimmer using register script above.

 

6) Restart the Search Service Host.

 

a. net stop "SharePoint Search Host Controller”

 

b. net start “SharePoint Search Host Controller”

 

7) Use appcmd list wp to get the correct Worker Process ID

 

8) Attach to the correct w3wp.exe and all noderunner.exe instances (not sure if there’s a way to get the correct instance or not).

 

9) Start start a Search using and Enterprise Search Center Site Collection.

 

I got frequent problems like time outs and I always had to start the search on the same login account as Visual Studio was running in. Nevertheless it was possible and I did it more than once with the same steps as above.


Conclusion

We’ve covered the basics of how claims are sent to SharePoint in the customer connector. We covered the basics of the custom Security Pre-Trimmer in SharePoint 2013 and how it can use the claims sent by the custom connector to let the Query Engine specify claims-based ACLs so that only relevant result are returned to the results page.

 

SearchSecuirtyTrimmerExample.zip

6 Comments
Occasional Visitor

Hi, Thanks for writing this blog. I implemented all above steps in SharePoint 2019 and tried to crawl the XML data. I am getting error while crawling. “Error while crawling LOB contents. ( Error caused by exception: Microsoft.SharePoint.BusinessData.Parser.PackageFormatException DotNetAssembly/WebService/Custom system type is not supported in FileBackedMetadaCatalog.”

 

Please let me know if this solution is feasible in SharePoint 2019. @SPDev_Support 

 

Thanks!

Frequent Visitor

We are facing the same issue with a former working connector since security update SP 2016 (KB4484512, KB4484506).

@SPDev_Support  

Microsoft

Unfortunately we have not tested in SP2016 or SP2019 and doubt this will work in SP2016 or SP2019.

Frequent Visitor

I have opened a support ticket with Microsoft. The result is that it is a bug that will most likely be fixed with the coming CU. Anyway, I got a not yet released update package, so everything is working again ;)

Occasional Visitor

Thanks @Boris Hofmann  & @SPDev_Support  for your response.

 

@Boris Hofmann Really glad to know that it worked for you. We also have a support ticket open with Microsoft. Can you please share the KB number or name of the package?

 

Also, We are going to crawl the data from SQL DB. Will it work with SQL as well?

 

Thanks!

Frequent Visitor

@saketm89 I guess it is kb4462233 the file was named (sts2016-kb4462233-fullfile-x64-glb.exe)