public class OsPassExpirationChecker
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
CHANGE_OS_PASS_CMD
The bash command to change the current OS user password.
|
private static java.lang.String |
EPOCH_DATE_IN_SEC_TO_PASS_EXPIRATION_CMD
The bash command to get the epoch date (in seconds) of the OS account pass expiration.
|
private static java.lang.String |
GET_WARNING_PERIOD_DAYS_CMD
The bash command to get the warning period of OS account password expiration in days.
|
private static CentralLogger |
LOG
Logger.
|
| Constructor and Description |
|---|
OsPassExpirationChecker() |
| Modifier and Type | Method and Description |
|---|---|
private static Tuple<java.lang.Integer,java.lang.String> |
changeOsUserPass(OsPassChangeInput osPassChangeInput,
ScreenWebDriver driver)
Changes the password for the OS user.
|
private static long |
getEpochDateInSecToPassExpiration()
Returns the date of OS pass expiration in epoch seconds, or -1 if the cmd fails.
|
private static long |
getWarningPeriodSeconds()
Returns the warning period of OS pass expiration in seconds, or -1 if the cmd fails.
|
private static boolean |
handleOsPassChangeInput(OsPassChangeInput osPassChangeInput,
boolean isExpired,
ScreenWebDriver webDriver,
java.lang.String osUserName)
Handles the result of an OS account pass change.
|
static boolean |
runCheck(java.lang.String osUserName)
Runs a check on the OS account.
|
private static final CentralLogger LOG
private static final java.lang.String GET_WARNING_PERIOD_DAYS_CMD
private static final java.lang.String EPOCH_DATE_IN_SEC_TO_PASS_EXPIRATION_CMD
The plain cmd for terminal: date -d "`passwd -S | cut -d ' ' -f 3`+`passwd -S | cut -d ' ' -f 5` days" +"%s"
private static final java.lang.String CHANGE_OS_PASS_CMD
public static boolean runCheck(java.lang.String osUserName)
osUserName - The OS account name.true if the OS user password is not expired or is successfully changed,
false otherwise.private static long getWarningPeriodSeconds()
throws java.io.IOException
java.io.IOException - Exception caused by executing the bash command or reading the result of it.private static long getEpochDateInSecToPassExpiration()
throws java.io.IOException
java.io.IOException - Exception caused by executing the bash command or reading the result of it.private static boolean handleOsPassChangeInput(OsPassChangeInput osPassChangeInput, boolean isExpired, ScreenWebDriver webDriver, java.lang.String osUserName) throws java.io.IOException
osPassChangeInput - The input of the OS pass change dialog.isExpired - Flag to indicate if the OS pass is already expired.webDriver - The web driver.osUserName - The OS account name.true if the OS user password is not expired or is successfully changed,
false otherwise.java.io.IOException - Exception caused by executing the bash command or reading the result of it.private static Tuple<java.lang.Integer,java.lang.String> changeOsUserPass(OsPassChangeInput osPassChangeInput, ScreenWebDriver driver) throws java.io.IOException
osPassChangeInput - The input of the OS pass change dialog.driver - The web driver.null.java.io.IOException - Exception caused by executing the bash command or reading the result of it.