本文整理汇总了Java中com.novell.ldap.LDAPAttribute类的典型用法代码示例。如果您正苦于以下问题:Java LDAPAttribute类的具体用法?Java LDAPAttribute怎么用?Java LDAPAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LDAPAttribute类属于com.novell.ldap包,在下文中一共展示了LDAPAttribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSearchRootNotBound
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
@Test
public void testSearchRootNotBound() throws Exception {
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("namingContexts","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("",0,"(objectClass=*)",new String[] {"1.1"},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
示例2: 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
示例3: modify
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
public void modify(ModifyInterceptorChain chain, DistinguishedName dn,
ArrayList<LDAPModification> mods, LDAPConstraints constraints)
throws LDAPException {
NamingUtils util = new NamingUtils();
ArrayList<LDAPModification> nmods = new ArrayList<LDAPModification>();
Iterator<LDAPModification> it = mods.iterator();
while (it.hasNext()) {
LDAPModification mod = it.next();
LDAPAttribute attrib = mod.getAttribute();
LDAPAttribute nattrib = this.mapAttribute(true, util, attrib);
nmods.add(new LDAPModification(mod.getOp(),nattrib));
}
chain.nextModify(dn, nmods, constraints);
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:19,代码来源:DNAttributeMapper.java
示例4: renameAttribute
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
public void renameAttribute(String oldAttribName,String newAttribName) {
LDAPAttribute attrib = entry.getAttribute(oldAttribName);
if (attrib == null) {
return;
}
entry.getAttributeSet().remove(attrib);
LDAPAttribute newAttrib = new LDAPAttribute(newAttribName);
byte[][] vals = attrib.getByteValueArray();
for (int i=0,m=vals.length;i<m;i++) {
newAttrib.addValue(vals[i]);
}
entry.getAttributeSet().add(newAttrib);
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:19,代码来源:Entry.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.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
示例6: add
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
public void add(AddInterceptorChain chain, Entry entry,
LDAPConstraints constraints) throws LDAPException {
DN dn = new DN(entry.getEntry().getDN());
Vector<RDN> rdns = dn.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.addRDNToBack(rdn);
}
if (this.attribsToStore.contains(rdn.getType().toLowerCase())) {
entry.getEntry().getAttributeSet().add(new LDAPAttribute(rdn.getType(),rdn.getValue()));
}
}
entry.setDN(newDN);
chain.nextAdd(entry,constraints);
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:24,代码来源:FlattenNamespace.java
示例7: toLDIF
import com.novell.ldap.LDAPAttribute; //导入依赖的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
示例8: testAddAnonFail
import com.novell.ldap.LDAPAttribute; //导入依赖的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
示例9: testAddBoundFail
import com.novell.ldap.LDAPAttribute; //导入依赖的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
示例10: testSearchUsersBound
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
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,代码行数:26,代码来源:TestACLPlugin.java
示例11: testSimpleSearchCNSubstr1
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
public void testSimpleSearchCNSubstr1() 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=A*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,代码行数:39,代码来源:TestJDBCUid.java
示例12: 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
示例13: 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
示例14: testSearchUsersBound
import com.novell.ldap.LDAPAttribute; //导入依赖的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
示例15: 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
示例16: mapEntry
import com.novell.ldap.LDAPAttribute; //导入依赖的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
示例17: testSimpleCaseAttrib
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
@Test
public void testSimpleCaseAttrib() 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[] {"objectclass","UiD","givenNamE","Sn"},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
示例18: rename
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
public void rename(String newName) {
LDAPAttribute newAttrib = new LDAPAttribute(newName);
byte[][] vals = this.attribute.getByteValueArray();
for (int i=0,m=vals.length;i<m;i++) {
newAttrib.addValue(vals[i]);
}
this.attribute = newAttrib;
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:11,代码来源:Attribute.java
示例19: loadProps
import com.novell.ldap.LDAPAttribute; //导入依赖的package包/类
private void loadProps(Properties props,LDAPAttribute repos, String attribName, String delim) {
StringTokenizer toker;
toker = new StringTokenizer(props.getProperty(attribName,""),delim);
while (toker.hasMoreTokens()) {
repos.addValue(toker.nextToken());
}
}
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:8,代码来源:RootDSE.java
示例20: 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
注:本文中的com.novell.ldap.LDAPAttribute类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论