SearchControls ctls = new SearchControls();
ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
adminDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
CoreSession adminSession = new DefaultCoreSession(
new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
SearchOperationContext searchOperationContext = new SearchOperationContext( adminSession, baseDn,
filter, ctls );
searchOperationContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );