修改ladp属性.
来源:互联网 发布:稀疏a算法一致性条件 编辑:程序博客网 时间:2024/06/04 19:12
添加ldapjdk.jar库..
如:关闭ldap帐号认证.
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: Geong</p>
* @author Will he
* @date 2008-4-02
* @version 1.0
*/
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: Geong</p>
* @author Will he
* @date 2008-4-02
* @version 1.0
*/
package ldap;
import netscape.ldap.LDAPAttribute;
import netscape.ldap.LDAPConnection;
import netscape.ldap.LDAPException;
import netscape.ldap.LDAPModification;
import netscape.ldap.LDAPModificationSet;
/** *//**
* @author willhe
* 修改ldap属性..
* 关闭ldap帐号..
*/
public class LdapModifyAttributeTest ...{
/** *//**
* @param args
*/
public static void main(String[] args) ...{
test();
}
public static void test()...{
/** *//**
* 在原有基础上添加一个属性,用来关闭ldap帐号
*/
LDAPConnection ldapCon = null;
String hostname ="";
int port = 389;
String ldapdn ="ou=People,o=bankcomm.com,o=bankcomm";
String uid = "";
try ...{
ldapCon = new LDAPConnection();
ldapCon.connect(hostname, port);
//管理端密码.
ldapCon.authenticate("cn=directory manager", "******");
String dn = "uid=" + uid + "," + ldapdn;
LDAPModificationSet set = new LDAPModificationSet();
set.add(LDAPModification.REPLACE, new LDAPAttribute("uid", uid));
set.add(LDAPModification.ADD, new LDAPAttribute("nsaccountlock", "true"));
ldapCon.modify(dn, set);
} catch (LDAPException e) ...{
System.out.println("-------LDAPException:" +e.getMessage());
} finally ...{
try ...{
if (ldapCon != null)
ldapCon.disconnect();
} catch (LDAPException e) ...{
System.out.println("LDAPException closed ldapCon;" +e.getMessage());
}
}
}
}
import netscape.ldap.LDAPAttribute;
import netscape.ldap.LDAPConnection;
import netscape.ldap.LDAPException;
import netscape.ldap.LDAPModification;
import netscape.ldap.LDAPModificationSet;
/** *//**
* @author willhe
* 修改ldap属性..
* 关闭ldap帐号..
*/
public class LdapModifyAttributeTest ...{
/** *//**
* @param args
*/
public static void main(String[] args) ...{
test();
}
public static void test()...{
/** *//**
* 在原有基础上添加一个属性,用来关闭ldap帐号
*/
LDAPConnection ldapCon = null;
String hostname ="";
int port = 389;
String ldapdn ="ou=People,o=bankcomm.com,o=bankcomm";
String uid = "";
try ...{
ldapCon = new LDAPConnection();
ldapCon.connect(hostname, port);
//管理端密码.
ldapCon.authenticate("cn=directory manager", "******");
String dn = "uid=" + uid + "," + ldapdn;
LDAPModificationSet set = new LDAPModificationSet();
set.add(LDAPModification.REPLACE, new LDAPAttribute("uid", uid));
set.add(LDAPModification.ADD, new LDAPAttribute("nsaccountlock", "true"));
ldapCon.modify(dn, set);
} catch (LDAPException e) ...{
System.out.println("-------LDAPException:" +e.getMessage());
} finally ...{
try ...{
if (ldapCon != null)
ldapCon.disconnect();
} catch (LDAPException e) ...{
System.out.println("LDAPException closed ldapCon;" +e.getMessage());
}
}
}
}
- 修改ladp属性.
- LADP
- spring ladp
- Ladp 理解
- 什么是LADP
- LADP使用
- LADP资料收集
- LADP 中 ObjectClass
- ladp的部署
- 修改属性
- LADP精彩推荐(持续更新)
- 使用ladp null文章连接的安全问题
- 添加字段 修改属性
- 修改字段属性
- 修改文件夹的属性
- 如何修改系统属性
- win32 修改窗口属性
- 修改windows服务属性
- 精妙SQL语句
- [转]Orcle and SQL Functions (http://jim.blueidea.com/archives/2006/3715.shtml)
- SQL函数设计之临时表的使用
- 搞笑
- Oracle9i配置和启动企业管理器
- 修改ladp属性.
- 数字签名的工具与实践
- Delphi中捕获控制台程序的输出
- SQL Server 2000中的SQL语言简介(一)
- SQL教程之Group by和Having
- 自学.NET
- XMLHttpRequest 对象的使用
- 正则表达式语法参考
- 胡思乱想之PPT上的板书插件