public class AD extends Object
Modifier and Type | Method and Description |
---|---|
static long |
aDTimeToUnixTimestamp(long aDTime)
Transform an AD timestamp to a Unix timestamp.
|
static long |
aDTimeToUnixTimestamp(String aDTimeString)
Helper method to automatically parse an AD timestamp from a String before
calling
aDTimeToUnixTimestamp(long) . |
static long |
getAccountExpires(String expireDate)
Returns the accountexpires time in Microsoft format
|
static long |
getAccountExpires(String expireDate,
String format)
Return the accountexpires time in Microsoft format
|
static int |
getNumberOfWeeksSinceLastLogon(String lastLogonTimestamp)
Return the number of weeks since the last logon
|
static byte[] |
getUnicodePwd(String password)
Encode a password so that it can be updated in Active Directory
in the field unicodePwd.
|
static long |
unixTimestampToADTime(long unixTimestamp)
Transform a Unix timestamp to an AD timestamp.
|
static long |
unixTimestampToADTime(String unixTimestampString)
Helper method to automatically parse a Unix timestamp from a String before
calling
unixTimestampToADTime(long) . |
static boolean |
userAccountControlCheck(int value,
String constToCheck)
Check if a bit is set in UserAccountControl
|
static int |
userAccountControlSet(int origValue,
String[] constToApply)
Set or unset some bits to a UserAccountControl attribute of an AD
|
static int |
userAccountControlToggle(int value,
String constToApply)
Toggle a bit in UserAccountControl
|
public static final Integer UAC_SCRIPT
public static final Integer UAC_ACCOUNTDISABLE
public static final Integer UAC_HOMEDIR_REQUIRED
public static final Integer UAC_LOCKOUT
public static final Integer UAC_PASSWD_NOTREQD
public static final Integer UAC_PASSWD_CANT_CHANGE
public static final Integer UAC_ENCRYPTED_TEXT_PWD_ALLOWED
public static final Integer UAC_TEMP_DUPLICATE_ACCOUNT
public static final Integer UAC_NORMAL_ACCOUNT
public static final Integer UAC_INTERDOMAIN_TRUST_ACCOUNT
public static final Integer UAC_WORKSTATION_TRUST_ACCOUNT
public static final Integer UAC_SERVER_TRUST_ACCOUNT
public static final Integer UAC_DONT_EXPIRE_PASSWORD
public static final Integer UAC_MNS_LOGON_ACCOUNT
public static final Integer UAC_SMARTCARD_REQUIRED
public static final Integer UAC_TRUSTED_FOR_DELEGATION
public static final Integer UAC_NOT_DELEGATED
public static final Integer UAC_USE_DES_KEY_ONLY
public static final Integer UAC_DONT_REQ_PREAUTH
public static final Integer UAC_PASSWORD_EXPIRED
public static final Integer UAC_TRUSTED_TO_AUTH_FOR_DELEGATION
public static final Integer UAC_SET_SCRIPT
public static final Integer UAC_UNSET_SCRIPT
public static final Integer UAC_SET_ACCOUNTDISABLE
public static final Integer UAC_UNSET_ACCOUNTDISABLE
public static final Integer UAC_SET_HOMEDIR_REQUIRED
public static final Integer UAC_UNSET_HOMEDIR_REQUIRED
public static final Integer UAC_SET_LOCKOUT
public static final Integer UAC_UNSET_LOCKOUT
public static final Integer UAC_SET_PASSWD_NOTREQD
public static final Integer UAC_UNSET_PASSWD_NOTREQD
public static final Integer UAC_SET_PASSWD_CANT_CHANGE
public static final Integer UAC_UNSET_PASSWD_CANT_CHANGE
public static final Integer UAC_SET_ENCRYPTED_TEXT_PWD_ALLOWED
public static final Integer UAC_UNSET_ENCRYPTED_TEXT_PWD_ALLOWED
public static final Integer UAC_SET_TEMP_DUPLICATE_ACCOUNT
public static final Integer UAC_UNSET_TEMP_DUPLICATE_ACCOUNT
public static final Integer UAC_SET_NORMAL_ACCOUNT
public static final Integer UAC_UNSET_NORMAL_ACCOUNT
public static final Integer UAC_SET_INTERDOMAIN_TRUST_ACCOUNT
public static final Integer UAC_UNSET_INTERDOMAIN_TRUST_ACCOUNT
public static final Integer UAC_SET_WORKSTATION_TRUST_ACCOUNT
public static final Integer UAC_UNSET_WORKSTATION_TRUST_ACCOUNT
public static final Integer UAC_SET_SERVER_TRUST_ACCOUNT
public static final Integer UAC_UNSET_SERVER_TRUST_ACCOUNT
public static final Integer UAC_SET_DONT_EXPIRE_PASSWORD
public static final Integer UAC_UNSET_DONT_EXPIRE_PASSWORD
public static final Integer UAC_SET_MNS_LOGON_ACCOUNT
public static final Integer UAC_UNSET_MNS_LOGON_ACCOUNT
public static final Integer UAC_SET_SMARTCARD_REQUIRED
public static final Integer UAC_UNSET_SMARTCARD_REQUIRED
public static final Integer UAC_SET_TRUSTED_FOR_DELEGATION
public static final Integer UAC_UNSET_TRUSTED_FOR_DELEGATION
public static final Integer UAC_SET_NOT_DELEGATED
public static final Integer UAC_UNSET_NOT_DELEGATED
public static final Integer UAC_SET_USE_DES_KEY_ONLY
public static final Integer UAC_UNSET_USE_DES_KEY_ONLY
public static final Integer UAC_SET_DONT_REQ_PREAUTH
public static final Integer UAC_UNSET_DONT_REQ_PREAUTH
public static final Integer UAC_SET_PASSWORD_EXPIRED
public static final Integer UAC_UNSET_PASSWORD_EXPIRED
public static final Integer UAC_SET_TRUSTED_TO_AUTH_FOR_DELEGATION
public static final Integer UAC_UNSET_TRUSTED_TO_AUTH_FOR_DELEGATION
public static int userAccountControlSet(int origValue, String[] constToApply)
origValue
- the original value of UserAccessControlconstToApply
- an Array of constants to applypublic static boolean userAccountControlCheck(int value, String constToCheck)
value
- the value of UserAccountControlconstToCheck
- a constant to testpublic static int userAccountControlToggle(int value, String constToApply)
value
- the value of UserAccountControlconstToApply
- the bit to togglepublic static byte[] getUnicodePwd(String password) throws UnsupportedEncodingException
password
- The cleartext password to be encodedUnsupportedEncodingException
public static long aDTimeToUnixTimestamp(long aDTime)
Transform an AD timestamp to a Unix timestamp.
AD timestamps are the number of 100-nanosecond ticks since 1 January 1601 00:00:00 UT. Unix timestamps are the number of seconds elapsed since the start of the epoch at 1 January 1970 00:00:00 UT. Source: http://en.wikipedia.org/wiki/System_time.
This method returns the number of seconds elapsed since the start of the Unix epoch as represented by the AD timestamp given. Any extra precision as provided by the AD timestamp is discarded (truncated, not rounded).
aDTime
- An AD timestamp as a longpublic static long aDTimeToUnixTimestamp(String aDTimeString)
Helper method to automatically parse an AD timestamp from a String before
calling aDTimeToUnixTimestamp(long)
.
aDTimeString
- A string containing an AD timestampaDTimeToUnixTimestamp(long)
public static long unixTimestampToADTime(long unixTimestamp)
Transform a Unix timestamp to an AD timestamp.
AD timestamps are the number of 100-nanosecond ticks since 1 January 1601 00:00:00 UT. Unix timestamps are the number of seconds elapsed since the start of the epoch at 1 January 1970 00:00:00 UT. Source: http://en.wikipedia.org/wiki/System_time.
This method returns the number of 100-nanosecond ticks elapsed since the start of the AD epoch as represented by the Unix timestamp given. The extra precision in the AD timestamp representation is set to zeroes (0).
unixTimestamp
- A Unix timestamp as an intpublic static long unixTimestampToADTime(String unixTimestampString)
Helper method to automatically parse a Unix timestamp from a String before
calling unixTimestampToADTime(long)
.
unixTimestampString
- A Unix timestamp as an long#unixTimestampToADTime(int)
public static int getNumberOfWeeksSinceLastLogon(String lastLogonTimestamp)
lastLogonTimestamp
- public static long getAccountExpires(String expireDate, String format) throws ParseException
expireDate
- the date in any formatformat
- The format of the date expireDate. See http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html.ParseException
public static long getAccountExpires(String expireDate) throws ParseException
expireDate
- the date in the format yyyy-MM-dd.ParseException
Copyright © 2005-2024 LSC project. All Rights Reserved.