当前位置: 首页>>代码示例>>Java>>正文


Java LDAPAttribute.getStringValueArray方法代码示例

本文整理汇总了Java中com.novell.ldap.LDAPAttribute.getStringValueArray方法的典型用法代码示例。如果您正苦于以下问题:Java LDAPAttribute.getStringValueArray方法的具体用法?Java LDAPAttribute.getStringValueArray怎么用?Java LDAPAttribute.getStringValueArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.novell.ldap.LDAPAttribute的用法示例。


在下文中一共展示了LDAPAttribute.getStringValueArray方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: revalueAttribute

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void revalueAttribute(String attrib,HashMap<String,String> map) {
	LDAPAttribute attribute = this.entry.getAttribute(attrib);
	
	if (attribute == null) {
		return;
	}
	
	String[] vals = attribute.getStringValueArray();
	for (int i=0,m=vals.length;i<m;i++) {
		String newVal = map.get(vals[i].toLowerCase());
		if (newVal != null) {
			attribute.removeValue(vals[i]);
			attribute.addValue(newVal);
		}
	}
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:17,代码来源:Entry.java

示例2: postSearchEntry

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
@Override
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);

	LDAPAttribute attr = entry.getEntry().getAttribute("objectClass");
	if (attr != null) {
		String[] vals = attr.getStringValueArray();
		for (String oc : vals) {
			if (oc.equalsIgnoreCase(this.objectClass)) {
				LDAPAttribute nattr = new LDAPAttribute(this.attributeName,this.attributeValue);
				entry.getEntry().getAttributeSet().add(nattr);
			}
		}
	}
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:19,代码来源:AddAttribute.java

示例3: checkObjectClass

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
private boolean checkObjectClass(Entry entry, LDAPAttribute nocs) {
	
	boolean isDynGroup = false;
	
	LDAPAttribute ocs = entry.getEntry().getAttribute("objectClass");
	if (ocs != null) {
		String[] vals = ocs.getStringValueArray();
		for (int i=0;i<vals.length;i++) {
			if (vals[i].equalsIgnoreCase(dynOC)) {
				isDynGroup = true;
				nocs.addValue(staticOC);
			} else {
				nocs.addValue(vals[i]);
			}
		}
		
		
		
	}
	
	return isDynGroup;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:23,代码来源:DynamicGroups.java

示例4: postSearchEntry

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
@Override
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);
	
	LDAPAttribute attr = entry.getEntry().getAttribute(this.attributeName);
	if (attr != null) {
		LDAPAttribute nattr = new LDAPAttribute(this.attributeName);
		String[] vals = attr.getStringValueArray();
		for (String val : vals) {
			nattr.addValue(this.attr2dn(val,chain));
		}
		entry.getEntry().getAttributeSet().remove(this.attributeName);
		entry.getEntry().getAttributeSet().add(nattr);
	}

}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:20,代码来源:Attribute2DN.java

示例5: postSearchEntry

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
@Override
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);
	
	LDAPAttribute attr = entry.getEntry().getAttribute(this.sourceAttribute);
	if (attr != null) {
		LDAPAttribute nattr = new LDAPAttribute(this.sourceAttribute);
		String[] dns = attr.getStringValueArray();
		for (String dn : dns) {
			nattr.addValue(this.dn2attr(dn, chain));
		}
		entry.getEntry().getAttributeSet().remove(this.sourceAttribute);
		entry.getEntry().getAttributeSet().add(nattr);
	}

}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:20,代码来源:Dn2Attribute.java

示例6: postSearchEntry

import com.novell.ldap.LDAPAttribute; //导入方法依赖的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);
	
	LDAPAttribute member = entry.getEntry().getAttribute(this.attribName);
	if (member != null) {
		entry.getEntry().getAttributeSet().remove(member);
		LDAPAttribute newMembers = new LDAPAttribute(this.attribName);
		
		String[] vals = member.getStringValueArray();
		for (int i=0,m=vals.length;i<m;i++) {
			newMembers.addValue(this.rdnAttrib + "=" + vals[i] + "," + this.suffix);
		}
		
		entry.getEntry().getAttributeSet().add(newMembers);
	}

}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:22,代码来源:DBGroups.java

示例7: postSearchEntry

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
@Override
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);

	LDAPAttribute attr = entry.getEntry().getAttribute("objectClass");
	if (attr != null) {
		String[] vals = attr.getStringValueArray();
		for (String oc : vals) {
			if (oc.equalsIgnoreCase(this.objectClass)) {
				ArrayList<LDAPAttribute> toRm = new ArrayList<LDAPAttribute>();
				
				for (Object obj : entry.getEntry().getAttributeSet()) {
					LDAPAttribute ldapAttr = (LDAPAttribute) obj;
					if (! this.allowed.contains(ldapAttr.getName().toLowerCase())) {
						
						toRm.add(ldapAttr);
					}
				}
				
				entry.getEntry().getAttributeSet().removeAll(toRm);
				
			}
		}
	}

}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:30,代码来源:AttributeFilter.java

示例8: loadRequest

import com.novell.ldap.LDAPAttribute; //导入方法依赖的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

示例9: add

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void add(AddInterceptorChain chain, Entry entry,
		LDAPConstraints constraints) throws LDAPException {
	Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + "LDAPBaseServer");
	
	if (con == null) {
		throw new LDAPException("Operations Error",LDAPException.OPERATIONS_ERROR,"No Database Connection");
	}
	
	try {
		// begin the transaction
		con.setAutoCommit(false);
		
		HashMap<String,String> db2ldap = (HashMap<String, String>) chain.getRequest().get(JdbcInsert.MYVD_DB_DB2LDAP + "LDAPBaseServer");
		
		PreparedStatement ps = con.prepareStatement("INSERT INTO USERS (id,firstname,lastname,username) VALUES (?,?,?,?)");
		ps.setInt(1, 5); //this is horrible practice
		ps.setString(2, entry.getEntry().getAttribute(db2ldap.get("firstname")).getStringValue());
		ps.setString(3, entry.getEntry().getAttribute(db2ldap.get("lastname")).getStringValue());
		ps.setString(4, entry.getEntry().getAttribute(db2ldap.get("username")).getStringValue());
		
		ps.executeUpdate();
		
		ps.close();
		
		ps = con.prepareStatement("SELECT id FROM LOCATIONS WHERE name=?");
		PreparedStatement inst = con.prepareStatement("INSERT INTO LOCATIONMAP (person,location) VALUES (?,?)");
		LDAPAttribute l = entry.getEntry().getAttribute(db2ldap.get("name"));
		
		if (l == null) {
			con.rollback();
			throw new LDAPException("Location is required",LDAPException.OBJECT_CLASS_VIOLATION,"Location is required");
		}
		
		String[] vals = l.getStringValueArray();
		for (int i=0;i<vals.length;i++) {
			ps.setString(1, vals[i]);
			ResultSet rs = ps.executeQuery();
			if (! rs.next()) {
				con.rollback();
				throw new LDAPException("Location " + vals[i] + " does not exist",LDAPException.OBJECT_CLASS_VIOLATION,"Location " + vals[i] + " does not exist");
			}
			
			inst.setInt(1, 5);
			inst.setInt(2, rs.getInt("id"));
			
			inst.executeUpdate();
		}
		
		ps.close();
		inst.close();
		
		con.commit();
	
	} catch (SQLException e) {
		try {
			con.rollback();
			
		} catch (SQLException e1) {
			throw new LDAPException("Could not add entry or rollback transaction",LDAPException.OPERATIONS_ERROR,e.toString(),e);
		}
		throw new LDAPException("Could not add entry",LDAPException.OPERATIONS_ERROR,e.toString(),e);
	}
	
	

}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:67,代码来源:UpdateDB.java

示例10: checkDynamicGroup

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
private boolean checkDynamicGroup(InterceptorChain chain) {
	try {
		SearchInterceptorChain searchChain = chain.createSearchChain();
		Results res = new Results(searchChain.getInterceptors());
		ArrayList<Attribute> attribs = new ArrayList<Attribute>();
		attribs.add(new Attribute("objectClass"));
		attribs.add(new Attribute("memberURL"));
		
		searchChain.nextSearch(new DistinguishedName(this.SubjectDN),new Int(0),new Filter("(objectClass=*)"),attribs,new Bool(false),res,new LDAPSearchConstraints());
		res.start();
		
		if (! res.hasMore()) {
			res.finish();
			return false;
		} else {
			LDAPEntry entry = res.next().getEntry();
			res.finish();
			LDAPAttribute attr = entry.getAttribute("objectClass");
			String[] vals = attr.getStringValueArray();
			for (int i=0;i<vals.length;i++) {
				if (vals[i].equalsIgnoreCase("groupofnames") || vals[i].equalsIgnoreCase("groupofuniquenames")) {
					boolean passed = this.checkStaticGroup(chain);
					if (passed) {
						return true;
					}
				}
			}
			
			Enumeration<String> enumer = entry.getAttribute("memberurl").getStringValues();
			while (enumer.hasMoreElements()) {
				if (passURL(chain,enumer.nextElement())) {
					return true;
				}
			}
			
			return false;
		}
	} catch (Exception e) {
		e.printStackTrace();
		return false;
	}
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:44,代码来源:AccessControlItem.java

示例11: checkObjectClass

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
private boolean checkObjectClass(Entry entry) {
	
	boolean isDynGroup = false;
	
	LDAPAttribute ocs = entry.getEntry().getAttribute("objectClass");
	if (ocs != null) {
		String[] vals = ocs.getStringValueArray();
		for (int i=0;i<vals.length;i++) {
			if (vals[i].equalsIgnoreCase(this.groupObjectClass)) {
				return true;
			} 
		}
		
		
		
	}
	
	return false;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:20,代码来源:PrimaryGroup.java

示例12: checkObjectClass

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
private boolean checkObjectClass(Entry entry) {
	
	boolean isGroup = false;
	
	LDAPAttribute ocs = entry.getEntry().getAttribute("objectClass");
	if (ocs != null) {
		String[] vals = ocs.getStringValueArray();
		for (int i=0;i<vals.length;i++) {
			if (vals[i].equalsIgnoreCase(staticOC)) {
				isGroup = true;
			} 
		}
		
		
		
	}
	
	return isGroup;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:20,代码来源:EmbeddedGroups.java

示例13: compareEntry

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public static boolean compareEntry(LDAPEntry entry1,LDAPEntry entry2)  {
	if (! entry1.getDN().equalsIgnoreCase(entry2.getDN())) {
		return false;
	}
	
	LDAPAttributeSet attribs1 = entry1.getAttributeSet();
	LDAPAttributeSet attribs2 = entry2.getAttributeSet();
	
	Iterator<?> it = attribs1.iterator();
	int size = attribs2.size();
	while (it.hasNext()) {
		LDAPAttribute attrib1 = (LDAPAttribute) it.next();
		LDAPAttribute attrib2 = attribs2.getAttribute(attrib1.getName());
		
		if (attrib2 == null ) {
			System.err.println("not found: " + attrib1.getName() + "\n" + "In Compare: Entries don't match : \nFrom Server\n" + toLDIF(entry1) + "\n\nFrom LDIF\n" + toLDIF(entry2));
			return false;
			
		}
		
		size--;
		
		String[] vals1 = attrib1.getStringValueArray();
		String[] vals2 = attrib2.getStringValueArray();
		
		if (vals2.length != vals1.length) {
			System.err.println(attrib1.getName() + "\n" + "In Compare: Entries don't match : \nFrom Server\n" + toLDIF(entry1) + "\n\nFrom LDIF\n" + toLDIF(entry2));
			return false;
		}
		
		for (int i=0,m=vals1.length;i<m;i++) {
			boolean found = false;
			for (int j=0,n=vals2.length;j<n;j++) {
				if (vals1[i].equalsIgnoreCase(vals2[j])) {
					found = true;
				}
			}
			
			if (! found) {
				System.err.println(attrib1.getName() + "/" + vals1[i] + "\n" + "In Compare: Entries don't match : \nFrom Server\n" + toLDIF(entry1) + "\n\nFrom LDIF\n" + toLDIF(entry2));
				return false;
			}
		}
	}
	
	if (size != 0) {
		return false;
	}
	
	return true;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:52,代码来源:Util.java

示例14: bindJoined

import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
private void bindJoined(BindInterceptorChain chain, DistinguishedName dn, Password pwd, LDAPConstraints constraints,
		Bool primaryBindFailed, HashMap<DN, DistinguishedName> boundNameSpaces) throws LDAPException {
	BindInterceptorChain bindChain;
	SearchInterceptorChain searchChain = new SearchInterceptorChain(chain.getBindDN(),chain.getBindPassword(),ns.getRouter().getGlobalChain().getLength(),ns.getRouter().getGlobalChain(),chain.getSession(),chain.getRequest(),ns.getRouter());
	Results res = new Results(new InsertChain(new Insert[0]));
	ArrayList<Attribute> attribs = new ArrayList<Attribute>();
	attribs.add(new Attribute("joinedDNs"));
	attribs.add(new Attribute("joinedBases"));
	searchChain.nextSearch(dn,new Int(0),Joiner.OBJ_CLASS_FILTER,attribs,new Bool(false),res,new LDAPSearchConstraints());
	
	res.start();
	if (! res.hasMore() && primaryBindFailed.getValue()) {
		throw new LDAPException("Could not bind to any services",LDAPException.INVALID_CREDENTIALS,dn.getDN().toString());
	}
	
	LDAPEntry entry = res.next().getEntry();
	res.finish();
	
	LDAPAttribute joinDNs = entry.getAttribute("joinedDNs");
	LDAPAttribute joinBases = entry.getAttribute("joinedBases");
	if (joinDNs == null) {
		if (primaryBindFailed.getValue()) {
			throw new LDAPException("Could not bind to any services",LDAPException.INVALID_CREDENTIALS,dn.getDN().toString());
		}
	} else {
		String[] dns = joinDNs.getStringValueArray();
		String[] bases = joinBases.getStringValueArray();
		for (int i=0,m=dns.length;i<m;i++) {
			bindChain = new BindInterceptorChain(chain.getBindDN(),chain.getBindPassword(),ns.getRouter().getGlobalChain().getLength(),ns.getRouter().getGlobalChain(),chain.getSession(),chain.getRequest(),ns.getRouter());
			try {
				DistinguishedName binddn = new DistinguishedName(dns[i]);
				bindChain.nextBind(binddn,pwd,constraints);
				boundNameSpaces.put(new DN(bases[i]), binddn);
				primaryBindFailed.setValue(false);
				break;
			} catch (LDAPException e) {
				if (e.getResultCode() != LDAPException.INVALID_CREDENTIALS) {
					throw e;
				}
				primaryBindFailed.setValue(true);
				
				boundNameSpaces.put(new DN(bases[i]), new DistinguishedName(""));
			}
		}
		
		
	}
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:49,代码来源:Joiner.java


注:本文中的com.novell.ldap.LDAPAttribute.getStringValueArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。