Active Directory Password Expiration
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jeff_Goodwin
Posted On:   Friday, May 10, 2002 06:42 AM

Can anyone tell me how to determine when a password is going to expire in Active Directory. I have written JNDI code to retrieve pwdLastSet attribute and have yet been able to make sense of the value. The MS documentation states that the pwdLastSet attrib contains the number of elapsed seconds since Jan 1, 1970. Very confused.

Re: Active Directory Password Expiration

Posted By:   Greg_Hubbard  
Posted On:   Wednesday, June 5, 2002 08:11 PM

Hi Jeff

This took a little while to sort. Sorry about the formatting.
Active directory provides a number representing the number of 100 nanosecond intervals since 1601, so there is a little conversion to get to a java usable number.


public java.util.Date convertPwdLastSetToExpiryDate(String attribute)
{
Date expiryDate = null;

try
{
Long l = new Long(attribute);

// Offset represents the number of 100 nanosecond
// intervals between Jan 01 1601 and Jan 01, 1970
String offset = "116444736000000000";
Long off = new Long(offset);

String milliSecondsInADay = "86400000";
Long dailyMilliseconds = new Long(milliSecondsInADay);
{ // I have used 90 days as a max age
Long maximumPasswordAgeDays = new Long(90);

expiryDate = new java.util.Date( (((l.longValue() - off.longValue()) / 10000)
+ (dailyMilliseconds.longValue() * maximumPasswordAgeDays.longValue())));
}
}
catch (Exception e)
{
System.out.println("convertPwdLastSetToExpiryDate - Error :" + e);
}
return expiryDate;

}


Hope this helps

Greg

Re: Active Directory Password Expiration

Posted By:   neal_ravindran  
Posted On:   Thursday, May 30, 2002 10:58 AM

Hi Jeff,

1.From where did you download the spi to interface with active directory?

2.Any links as to how to set the Active directory on my local win 2000 machine?
About | Sitemap | Contact