Hello Java和AD专家..
从AD读取accountExpires属性值时遇到问题。当我使用Java代码读取此属性时,我得到的结果为null。
然后我考虑通过使用以下代码打印所有AD属性来检查AD提供的各种属性:
Attributes allAttrs = ldapCtx.getAttributes(distinguishedName);
System.out.println("Total no.of properties: " + allAttrs.size());
try{
String attrs = "";
for (NamingEnumeration ae = allAttrs.getAll(); ae.hasMore();) {
Attribute attr = (Attribute) ae.next();
attrs = attrs+"\nFor attribute: "+ attr.getID()+" values are - ";
/* print each value */
for (NamingEnumeration e = attr.getAll(); e.hasMore(); attrs = attrs + e.next()+";");
}
System.out.println(attrs);
}
catch(Exception e){
System.out.println("Exception in getAttribute: " + e);
}
它列出了72个属性。并且accountExpires属性本身不存在:(
任何人都可以指导我为什么这个属性在我的情况下不可用以及如何摆脱这个
此致 FH
答案 0 :(得分:0)
它不会列出任何帐户到期属性。你需要计算它。假设您的密码到期限制为90天,并且您需要在剩余10天到期时向用户发送警告邮件。您将获得帐户创建日期,如果差异为80,则查找帐户创建日期与当前日期之间的天数,然后发送警告邮件。