本文整理汇总了Java中com.novell.ldap.util.DN类的典型用法代码示例。如果您正苦于以下问题:Java DN类的具体用法?Java DN怎么用?Java DN使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DN类属于com.novell.ldap.util包,在下文中一共展示了DN类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compare
import com.novell.ldap.util.DN; //导入依赖的package包/类
public int compare(Object o1, Object o2) {
DN dn1 = (DN) o1;
DN dn2 = (DN) o2;
int num1 = dn1.countRDNs();
int num2 = dn2.countRDNs();
if (num1 < num2) {
return -1;
}
if (num1 > num2) {
return 1;
}
try {
if (dn1.equals(dn2)) {
return 0;
}
} catch (IllegalArgumentException e) {
}
return dn1.toString().compareTo(dn2.toString());
}
示例2: next
import com.novell.ldap.util.DN; //导入依赖的package包/类
public Entry next() throws LDAPException {
if (this.currentEntry == null) {
return null;
}
this.entryGotten = true;
Entry entry = this.currentEntry;
if ((! this.skipDupes) || ! this.processed.contains(new DN(entry.getEntry().getDN()))) {
this.processed.add(new DN(entry.getEntry().getDN()));
return entry;
} else {
if (this.hasMore()) {
return this.next();
} else {
return null;
}
}
}
示例3: isDescendantOf
import com.novell.ldap.util.DN; //导入依赖的package包/类
private boolean isDescendantOf(DN parent,DN child) {
Vector<RDN> parentRDNs = parent.getRDNs();
Vector<RDN> childRDNs = child.getRDNs();
if (childRDNs.size() < parentRDNs.size()) {
return false;
}
int i = childRDNs.size() - 1;
int l = parentRDNs.size() - 1;
for ( ;l>=0;) {
if (! parentRDNs.get(l).equals(childRDNs.get(i))) {
return false;
}
i--;
l--;
}
return true;
}
示例4: delete
import com.novell.ldap.util.DN; //导入依赖的package包/类
public void delete(DeleteInterceptorChain chain, DistinguishedName dn,
LDAPConstraints constraints) throws LDAPException {
Vector<RDN> rdns = dn.getDN().getRDNs();
ListIterator it = rdns.listIterator();
DN newDN = new DN();
while (it.hasNext()) {
RDN rdn = (RDN) it.next();
if (! this.attribsToRemove.contains(rdn.getType().toLowerCase())) {
newDN.addRDN(rdn);
}
}
chain.nextDelete(dn,constraints);
}
示例5: delete
import com.novell.ldap.util.DN; //导入依赖的package包/类
public void delete(DeleteInterceptorChain chain, DistinguishedName dn,
LDAPConstraints constraints) throws LDAPException {
Vector rdns = dn.getDN().getRDNs();
RDN rdn = (RDN) rdns.get(0);
RDN newRdn = new RDN();
if (rdn.getType().equalsIgnoreCase(this.idAttrib)) {
newRdn.add(this.idType,rdn.getValue(),null);
} else {
//TODO: add jdbc call here?
//newRdn.add(this.idType,entry.getEntry().getAttribute(this.idAttrib).getStringValue(),null);
}
DN newDn = new DN();
newDn.addRDN(newRdn);
for (int i=1,m=rdns.size();i<m;i++) {
newDn.addRDN((RDN)rdns.get(i));
}
dn.setDN(newDn);
chain.nextDelete(dn,constraints);
}
示例6: modify
import com.novell.ldap.util.DN; //导入依赖的package包/类
public void modify(ModifyInterceptorChain chain, DistinguishedName dn,
ArrayList<LDAPModification> mods, LDAPConstraints constraints)
throws LDAPException {
Vector rdns = dn.getDN().getRDNs();
RDN rdn = (RDN) rdns.get(0);
RDN newRdn = new RDN();
if (rdn.getType().equalsIgnoreCase(this.idAttrib)) {
newRdn.add(this.idType,rdn.getValue(),null);
} else {
//TODO add jdbc?
//newRdn.add(this.idType,entry.getEntry().getAttribute(this.idAttrib).getStringValue(),null);
}
DN newDn = new DN();
newDn.addRDN(newRdn);
for (int i=1,m=rdns.size();i<m;i++) {
newDn.addRDN((RDN)rdns.get(i));
}
dn.setDN(newDn);
chain.nextModify(dn,mods,constraints);
}
示例7: setUp
import com.novell.ldap.util.DN; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
OpenLDAPUtils.killAllOpenLDAPS();
server = new StartOpenLDAP();
server.startServer(
System.getenv("PROJ_DIR") + "/test/TestLDAP", 10983,
"cn=admin,dc=domain,dc=com", "manager");
interceptor = new LDAPInterceptor();
Properties props = new Properties();
props.put("host", "localhost");
props.put("port", "10983");
props.put("remoteBase", "dc=domain,dc=com");
props.put("proxyDN", "cn=admin,dc=domain,dc=com");
props.put("proxyPass", "manager");
interceptor.configure("TestLDAP", props, new NameSpace("LDAP",
new DistinguishedName(new DN("o=mycompany,c=us")), 0, null,false));
}
示例8: getConnection
import com.novell.ldap.util.DN; //导入依赖的package包/类
private ConnectionWrapper getConnection(DN bindDN,Password pass,boolean force,DN base,HashMap<Object,Object> session,boolean forceBind) throws LDAPException {
ConnectionWrapper wrapper = null;
if (logger.isDebugEnabled()) {
logger.debug("Bound inserts : " + session.get(SessionVariables.BOUND_INTERCEPTORS));
}
if (this.passThroughBindOnly && ! force) {
wrapper = pool.getConnection(new DN(this.proxyDN),new Password(this.proxyPass),force);
} else if (forceBind || (! this.passThroughBindOnly && ((ArrayList<String>) session.get(SessionVariables.BOUND_INTERCEPTORS)).contains(this.name))) {
wrapper = pool.getConnection(bindDN,pass,force);
} else {
wrapper = pool.getConnection(new DN(this.proxyDN),new Password(this.proxyPass),force);
}
if (wrapper == null) {
throw new LDAPException("Could not get remote connection",LDAPException.SERVER_DOWN,base.toString());
} else {
return wrapper;
}
}
示例9: setUp
import com.novell.ldap.util.DN; //导入依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
this.server = new StartOpenLDAP();
this.server.startServer(
System.getenv("PROJ_DIR") + "/test/TestLDAP", 10983,
"cn=admin,dc=domain,dc=com", "manager");
interceptor = new LDAPInterceptor();
Properties props = new Properties();
props.put("host", "localhost");
props.put("port", "10983");
props.put("remoteBase", "dc=domain,dc=com");
props.put("proxyDN", "cn=admin,dc=domain,dc=com");
props.put("proxyPass", "manager");
interceptor.configure("TestLDAP", props, new NameSpace("LDAP",
new DistinguishedName(new DN("o=mycompany,c=us")), 0, null,false));
}
示例10: testSearchNamespaces
import com.novell.ldap.util.DN; //导入依赖的package包/类
public void testSearchNamespaces() {
NameSpace root = new NameSpace("root",new DistinguishedName("dc=domain,dc=com"),0,null,false);
NameSpace internal = new NameSpace("internal",new DistinguishedName("ou=internal,dc=domain,dc=com"),10,null,false);
NameSpace external = new NameSpace("external",new DistinguishedName("ou=external,dc=domain,dc=com"),15,null,false);
Router router = new Router(new InsertChain(new Insert[0]));
router.addBackend(root.getLabel(),root.getBase().getDN(),root);
router.addBackend(external.getLabel(),external.getBase().getDN(),external);
router.addBackend(internal.getLabel(),internal.getBase().getDN(),internal);
this.checkLevel(new DN("dc=com"),router.getLevel(new DN("dc=com")));
this.checkLevel(new DN("dc=domain,dc=com"),router.getLevel(new DN("dc=domain,dc=com")));
this.checkLevel(new DN("ou=external,dc=domain,dc=com"),router.getLevel(new DN("ou=external,dc=domain,dc=com")));
this.checkLevel(new DN("ou=internal,dc=domain,dc=com"),router.getLevel(new DN("ou=internal,dc=domain,dc=com")));
}
示例11: DistinguishedName
import com.novell.ldap.util.DN; //导入依赖的package包/类
public DistinguishedName(String dn) {
if (dn != null) {
this.dn = new DN(dn);
} else {
this.dn = new DN("");
}
}
示例12: Results
import com.novell.ldap.util.DN; //导入依赖的package包/类
public Results(InsertChain globalChain) {
this.results = new ArrayList<Result>();
this.finished = new ArrayList<Result>();
this.processed = new TreeSet<DN>(new DNComparer());
entryGotten = true;
notFounds = 0;
this.globalChain = globalChain;
this.start = 0;
this.skipDupes = true;
this.completed = false;
}
示例13: testThisFail
import com.novell.ldap.util.DN; //导入依赖的package包/类
@Test
public void testThisFail() throws Exception {
AccessControlItem aci = new AccessControlItem(0,"cn=test,ou=myorg,dc=domain,dc=com#entry#grant:r,w,o#[all]#this:");
SearchInterceptorChain chain = new SearchInterceptorChain(new DistinguishedName("uid=testuser,ou=users,dc=domain,dc=com"),new Password(""),0,this.globalChain,new HashMap<Object,Object>(),new HashMap<Object,Object>(),this.router);
if (aci.checkSubject(chain,new DN("uid=testuser1,ou=users,dc=domain,dc=com"))) {
fail("subject check failed");
}
}
示例14: mapFilter
import com.novell.ldap.util.DN; //导入依赖的package包/类
private void mapFilter(FilterNode node) {
String name;
String newName;
NamingUtils util = new NamingUtils();
switch (node.getType()) {
case EQUALS :
if (this.dnAttribs.contains(node.getName().toLowerCase()) && node.getValue().toLowerCase().endsWith(this.localBaseDN)) {
node.setValue(util.getRemoteMappedDN(new DN(node.getValue()), this.localBase, this.remoteBase).toString());
}
break;
case SUBSTR :
case GREATER_THEN :
case LESS_THEN:
case PRESENCE :
break;
case AND:
case OR:
Iterator<FilterNode> it = node.getChildren().iterator();
while (it.hasNext()) {
mapFilter(it.next());
}
break;
case NOT : mapFilter(node.getNot());
}
}
示例15: checkSubject
import com.novell.ldap.util.DN; //导入依赖的package包/类
public boolean checkSubject(InterceptorChain chain, DN entryDN) {
boolean subjectPassed = false;
switch (this.subjectType) {
case PUBLIC : subjectPassed = true; break;
case DN : subjectPassed = this.SubjectDN.equals(chain.getBindDN().getDN()); break;
case THIS : subjectPassed = entryDN.equals(chain.getBindDN().getDN()); break;
case SUBTREE : subjectPassed = isDescendantOf(this.SubjectDN,chain.getBindDN().getDN()); break;
case GROUP : subjectPassed = checkStaticGroup(chain); break;
case DYNAMIC_GROUP : subjectPassed = checkDynamicGroup(chain); break;
}
return subjectPassed;
}