本文整理汇总了Java中com.novell.ldap.LDAPEntry类的典型用法代码示例。如果您正苦于以下问题:Java LDAPEntry类的具体用法?Java LDAPEntry怎么用?Java LDAPEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LDAPEntry类属于com.novell.ldap包,在下文中一共展示了LDAPEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSearchPrimary
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testSearchPrimary() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost", 50983);
LDAPSearchResults res = con.search("o=mycompany,c=us", 2, "(cn=Test User2)", new String[0], false);
LDIFReader reader = new LDIFReader(new FileInputStream(System.getenv("PROJ_DIR") + "/test/TestJoin/ldifs/filterPrimary.ldif"));
Util util = new Util();
while (res.hasMore()) {
LDAPMessage msg = reader.readMessage();
if (msg == null) {
fail("number of results dont match");
return;
}
LDAPEntry fromldif = ((LDAPSearchResult) msg).getEntry();
LDAPEntry fromserver = res.next();
if (! util.compareEntry(fromserver, fromldif)) {
fail("Entries don't match : " + fromserver + "/" + fromldif);
}
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:27,代码来源:TestJoin.java
示例2: testSearchUsersBound
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testSearchUsersBound() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.bind(3,"uid=testuser,ou=users,dc=domain,dc=com","secret".getBytes());
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
attribs.add(new LDAPAttribute("cn","Test User1"));
attribs.add(new LDAPAttribute("sn","User1"));
attribs.add(new LDAPAttribute("uid","testuser1"));
attribs.add(new LDAPAttribute("l","location1"));
LDAPSearchResults res = con.search("ou=users,dc=domain,dc=com",1,"(uid=testuser1)",new String[0],false);
if (! res.hasMore()) {
fail("no results");
}
LDAPEntry fromServer = res.next();
LDAPEntry control = new LDAPEntry("uid=testuser1,ou=users,dc=domain,dc=com",attribs);
if (! Util.compareEntry(fromServer,control)) {
fail("invalid entry : " + fromServer.toString());
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:27,代码来源:TestACLPlugin.java
示例3: mapEntry
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public LDAPEntry mapEntry(LDAPEntry origEntry,boolean outbound) {
NamingUtils util = new NamingUtils();
LDAPAttributeSet nattribs = new LDAPAttributeSet();
LDAPAttributeSet origAttribs = origEntry.getAttributeSet();
Iterator it = origAttribs.iterator();
while (it.hasNext()) {
LDAPAttribute origAttrib = (LDAPAttribute) it.next();
LDAPAttribute nattrib = mapAttribute(outbound, util, origAttrib);
nattribs.add(nattrib);
}
return new LDAPEntry(origEntry.getDN(),nattribs);
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:17,代码来源:DNAttributeMapper.java
示例4: toLDIF
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public static String toLDIF(LDAPEntry entry) {
StringBuffer buf = new StringBuffer();
buf.append("dn: ").append(entry.getDN()).append('\n');
LDAPAttributeSet attrs = entry.getAttributeSet();
Iterator<LDAPAttribute> it = attrs.iterator();
while (it.hasNext()) {
LDAPAttribute attr = it.next();
Enumeration enumer = attr.getStringValues();
while (enumer.hasMoreElements()) {
buf.append(attr.getName()).append(": ").append(enumer.nextElement()).append('\n');
}
}
return buf.toString();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:21,代码来源:Util.java
示例5: testAddAnonFail
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public void testAddAnonFail() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("cn","Test Add"));
attribs.add(new LDAPAttribute("sn","Add"));
attribs.add(new LDAPAttribute("uid","tadd"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
LDAPEntry entry = new LDAPEntry("uid=tadd,ou=users,dc=domain,dc=com",attribs);
try {
con.add(entry);
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail("add succeeded");
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:25,代码来源:TestACLPlugin.java
示例6: testAddBoundFail
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public void testAddBoundFail() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.bind(3,"uid=testuser,ou=users,dc=domain,dc=com","secret".getBytes());
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("cn","Test Add"));
attribs.add(new LDAPAttribute("sn","Add"));
attribs.add(new LDAPAttribute("uid","tadd"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
LDAPEntry entry = new LDAPEntry("uid=tadd,ou=users,dc=domain,dc=com",attribs);
try {
con.add(entry);
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail("add succeeded");
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:26,代码来源:TestACLPlugin.java
示例7: testReadSchema
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testReadSchema() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("127.0.0.1", 50983);
LDAPSearchResults res = con.search("cn=schema", 0, "(objectClass=*)", new String[0], false);
res.hasMore();
LDAPEntry fromserver = res.next();
con.disconnect();
LDIFReader reader = new LDIFReader(new FileInputStream(System.getenv("PROJ_DIR") + "/dist/conf/openldap_schema.ldif"));
Util util = new Util();
LDAPMessage msg = reader.readMessage();
if (msg == null) {
fail("number of results dont match");
return;
}
LDAPEntry fromldif = ((LDAPSearchResult) msg).getEntry();
if (! util.compareEntry(fromserver, fromldif)) {
fail("Entries don't match\n from server: \n" + util.toLDIF(fromserver) + "\nfromldif:\n" + util.toLDIF(fromldif));
}
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:25,代码来源:TestSchemaInsert.java
示例8: testSearchJoined
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public void testSearchJoined() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost", 50983);
LDAPSearchResults res = con.search("o=mycompany,c=us", 2, "(appattrib1=sysx)", new String[0], false);
LDIFReader reader = new LDIFReader(new FileInputStream(System.getenv("PROJ_DIR") + "/test/TestJoin/ldifs/filterJoined.ldif"));
Util util = new Util();
while (res.hasMore()) {
LDAPMessage msg = reader.readMessage();
if (msg == null) {
fail("number of results dont match");
return;
}
LDAPEntry fromldif = ((LDAPSearchResult) msg).getEntry();
LDAPEntry fromserver = res.next();
if (! util.compareEntry(fromserver, fromldif)) {
fail("Entries don't match \nfrom server\n" + Util.toLDIF(fromserver) + "\n\nfrom ldif\n" + Util.toLDIF(fromldif));
}
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:26,代码来源:TestJoin.java
示例9: testBaseSearch
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public void testBaseSearch() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost", 50983);
LDAPSearchResults res = con.search("uid=user3,ou=people,o=mycompany,c=us", 0, "(objectClass=*)", new String[0], false);
LDIFReader reader = new LDIFReader(new FileInputStream(System.getenv("PROJ_DIR") + "/test/TestJoin/ldifs/baseSearch.ldif"));
Util util = new Util();
while (res.hasMore()) {
LDAPMessage msg = reader.readMessage();
if (msg == null) {
fail("number of results dont match");
return;
}
LDAPEntry fromldif = ((LDAPSearchResult) msg).getEntry();
LDAPEntry fromserver = res.next();
if (! util.compareEntry(fromserver, fromldif)) {
fail("Entries don't match : " + fromserver + "/" + fromldif);
}
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:26,代码来源:TestJoin.java
示例10: testSearchPickAttribs
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public void testSearchPickAttribs() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost", 50983);
LDAPSearchResults res = con.search("o=mycompany,c=us", 2, "(appattrib1=sysx)", new String[] {"cn","appattrib1","appattrib2"}, false);
LDIFReader reader = new LDIFReader(new FileInputStream(System.getenv("PROJ_DIR") + "/test/TestJoin/ldifs/pickAttribs.ldif"));
Util util = new Util();
while (res.hasMore()) {
LDAPMessage msg = reader.readMessage();
if (msg == null) {
fail("number of results dont match");
return;
}
LDAPEntry fromldif = ((LDAPSearchResult) msg).getEntry();
LDAPEntry fromserver = res.next();
if (! util.compareEntry(fromserver, fromldif)) {
fail("Entries don't match : " + fromserver + "/" + fromldif);
}
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:26,代码来源:TestJoin.java
示例11: testExternalWithInternalBase
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public void testExternalWithInternalBase() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("127.0.0.1", 50983);
LDAPSearchResults res = con.search("ou=internal,o=mycompany,c=us",2, "(|(cn=testrouting)([email protected]))", new String[]{}, false);
try {
if (res.hasMore()) {
LDAPEntry e1 = res.next();
Assert.fail("Results came back");
}
} catch (LDAPException e) {
if (e.getResultCode() != 32) {
throw e;
}
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:20,代码来源:TestAttributeRouter.java
示例12: testAddAnonFail
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testAddAnonFail() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("cn","Test Add"));
attribs.add(new LDAPAttribute("sn","Add"));
attribs.add(new LDAPAttribute("uid","tadd"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
LDAPEntry entry = new LDAPEntry("uid=tadd,ou=users,dc=domain,dc=com",attribs);
try {
con.add(entry);
} catch (LDAPException e) {
if (e.getResultCode() != LDAPException.INSUFFICIENT_ACCESS_RIGHTS) {
throw e;
} else {
return;
}
}
fail("add succeeded");
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:26,代码来源:TestACLPlugin.java
示例13: testAddBoundSucceed
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testAddBoundSucceed() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.bind(3,"cn=admin,dc=domain,dc=com","manager".getBytes());
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("cn","Test Add"));
attribs.add(new LDAPAttribute("sn","Add"));
attribs.add(new LDAPAttribute("uid","tadd"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
LDAPEntry entry = new LDAPEntry("uid=tadd,ou=users,dc=domain,dc=com",attribs);
con.add(entry);
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:17,代码来源:TestACLPlugin.java
示例14: postSearchEntry
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
public void postSearchEntry(PostSearchEntryInterceptorChain chain,
Entry entry, DistinguishedName base, Int scope, Filter filter,
ArrayList<Attribute> attributes, Bool typesOnly,
LDAPSearchConstraints constraints) throws LDAPException {
chain.nextPostSearchEntry(entry,base,scope,filter,attributes,typesOnly,constraints);
ArrayList<Attribute> origAttributes = (ArrayList<Attribute>) chain.getRequest().get(key);
attributes.clear();
attributes.addAll(origAttributes);
if (attributes.size() != 0 && ! attributes.contains(ALL_ATTRIBS)) {
LDAPAttributeSet newAttribs = new LDAPAttributeSet();
Iterator<Attribute> it = attributes.iterator();
while (it.hasNext()) {
LDAPAttribute attrib = entry.getEntry().getAttribute(it.next().getAttribute().getName());
if (attrib != null) {
newAttribs.add(attrib);
}
}
entry.setEntry(new LDAPEntry(entry.getEntry().getDN(),newAttribs));
}
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:29,代码来源:AttributeCleaner.java
示例15: testSearchNoAttribsFilter
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testSearchNoAttribsFilter() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost", 50983);
Util util = new Util();
LDAPSearchResults res = con.search("dc=nam,dc=compinternal,dc=com",2,"(uid=aa*)",new String[] {"1.1"},false);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("uid","aalberts"));
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
/*
attribs.add(new LDAPAttribute("givenname","Al"));
attribs.add(new LDAPAttribute("sn","Alberts"));*/
LDAPEntry entry = new LDAPEntry("uid=aalberts,dc=nam,dc=compinternal,dc=com",attribs);
if (! res.hasMore()) {
fail("entries not returned");
return;
}
LDAPEntry fromServer = res.next();
if (! util.compareEntry(entry,fromServer)) {
fail("2nd entry failed : \n" + util.toLDIF(fromServer));
}
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:30,代码来源:TestJDBCSimple.java
示例16: testSimpleSearchNoWhereOrder
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testSimpleSearchNoWhereOrder() throws LDAPException {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
Util util = new Util();
LDAPSearchResults res = con.search("dc=nam,dc=compinternal,dc=com",2,"(sn=Alberts)",new String[0],false);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
attribs.add(new LDAPAttribute("uid","aalberts"));
attribs.add(new LDAPAttribute("givenname","Al"));
attribs.add(new LDAPAttribute("sn","Alberts"));
LDAPEntry entry = new LDAPEntry("uid=aalberts,dc=nam,dc=compinternal,dc=com",attribs);
if (! res.hasMore()) {
fail("entries not returned");
return;
}
if (! util.compareEntry(entry,res.next())) {
fail("1st entry failed");
}
if (res.hasMore()) {
fail("too many entries");
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:35,代码来源:TestJDBCSimple.java
示例17: testSubtreeFromUser
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testSubtreeFromUser() throws LDAPException {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
Util util = new Util();
LDAPSearchResults res = con.search("empid=2,dc=nam,dc=compinternal,dc=com",2,"(objectClass=*)",new String[0],false);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("l","LA"));
attribs.getAttribute("l").addValue("NY");
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
attribs.add(new LDAPAttribute("uid","aalberts"));
attribs.add(new LDAPAttribute("empid","2"));
attribs.add(new LDAPAttribute("givenname","Al"));
attribs.add(new LDAPAttribute("sn","Alberts"));
attribs.add(new LDAPAttribute("cn","Al Alberts"));
LDAPEntry entry = new LDAPEntry("empid=2,dc=nam,dc=compinternal,dc=com",attribs);
if (! res.hasMore()) {
fail("entries not returned");
return;
}
if (! util.compareEntry(entry,res.next())) {
fail("1st entry failed");
}
if (res.hasMore()) {
fail("too many entries");
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:39,代码来源:TestJDBCUid.java
示例18: testSubtreeFromUser
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testSubtreeFromUser() throws LDAPException {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
Util util = new Util();
LDAPSearchResults res = con.search("uid=aalberts,dc=nam,dc=compinternal,dc=com",2,"(objectClass=*)",new String[0],false);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("l","LA"));
attribs.getAttribute("l").addValue("NY");
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
attribs.add(new LDAPAttribute("uid","aalberts"));
attribs.add(new LDAPAttribute("givenname","Al"));
attribs.add(new LDAPAttribute("sn","Alberts"));
LDAPEntry entry = new LDAPEntry("uid=aalberts,dc=nam,dc=compinternal,dc=com",attribs);
if (! res.hasMore()) {
fail("entries not returned");
return;
}
if (! util.compareEntry(entry,res.next())) {
fail("1st entry failed");
}
if (res.hasMore()) {
fail("too many entries");
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:37,代码来源:TestJDBC.java
示例19: loadRequest
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
private void loadRequest(InterceptorChain chain, DistinguishedName userdn) throws LDAPException {
SearchInterceptorChain nchain = chain.createSearchChain(chain.getPositionInChain(this));
Results res = new Results(null,chain.getPositionInChain(this));
ArrayList<net.sourceforge.myvd.types.Attribute> attribs = new ArrayList<net.sourceforge.myvd.types.Attribute>();
attribs.add(new Attribute("1.1"));
nchain.nextSearch(userdn, new Int(0), Joiner.OBJ_CLASS_FILTER, attribs, new Bool(false), res, new LDAPSearchConstraints());
res.start();
if (! res.hasMore()) {
res.finish();
throw new LDAPException("Object not found",LDAPException.NO_SUCH_OBJECT,"");
}
LDAPEntry entry = res.next().getEntry();
LDAPAttribute pdn = entry.getAttribute("primaryDN");
chain.getRequest().put(Joiner.MYVD_JOIN_PDN + this.name, new DistinguishedName(pdn.getStringValue()));
ArrayList<DistinguishedName> joinedDns = new ArrayList<DistinguishedName>();
LDAPAttribute jdn = entry.getAttribute("joinedDns");
String[] vals = jdn.getStringValueArray();
for (int i=0;i<vals.length;i++) {
joinedDns.add(new DistinguishedName(vals[i]));
}
chain.getRequest().put(Joiner.MYVD_JOIN_JDN + this.name, joinedDns);
loadRequestADD(chain);
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:32,代码来源:Joiner.java
示例20: testSimpleSearchCN
import com.novell.ldap.LDAPEntry; //导入依赖的package包/类
@Test
public void testSimpleSearchCN() throws LDAPException {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
Util util = new Util();
LDAPSearchResults res = con.search("dc=nam,dc=compinternal,dc=com",2,"(cn=Al Alberts)",new String[0],false);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("l","LA"));
attribs.getAttribute("l").addValue("NY");
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
attribs.add(new LDAPAttribute("uid","aalberts"));
attribs.add(new LDAPAttribute("empid","2"));
attribs.add(new LDAPAttribute("givenname","Al"));
attribs.add(new LDAPAttribute("sn","Alberts"));
attribs.add(new LDAPAttribute("cn","Al Alberts"));
LDAPEntry entry = new LDAPEntry("empid=2,dc=nam,dc=compinternal,dc=com",attribs);
if (! res.hasMore()) {
fail("entries not returned");
return;
}
if (! util.compareEntry(entry,res.next())) {
fail("1st entry failed");
}
if (res.hasMore()) {
fail("too many entries");
}
con.disconnect();
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:40,代码来源:TestJDBCUid.java
注:本文中的com.novell.ldap.LDAPEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论