Class ShadowFile.Entry
java.lang.Object
com.aoindustries.aoserv.daemon.posix.ShadowFile.Entry
- Enclosing class:
ShadowFile
Represents one line of the
/etc/shadow
file on a POSIX server.-
Constructor Summary
ConstructorDescriptionCreates a new shadow file entry for the given user.Entry
(User.Name username, String password, int changedDate, Integer minPasswordAge, Integer maxPasswordAge, Integer warningDays, Integer inactivateDays, Integer expirationDate, String flag) Constructs a shadow file entry given all the values.Creates a new shadow file entry for the given user and encrypted password. -
Method Summary
Modifier and TypeMethodDescription<A extends Appendable>
AappendTo
(A out) Appends thisShadowFile.Entry
as it would be written in/etc/shadow
, not including any newline.int
The days since Jan 1, 1970 password was last changed.static int
Gets the number of days from the Epoch for the current day.static int
getCurrentDate
(long time) Gets the number of days from the Epoch for the provided time in milliseconds from Epoch.The days since Jan 1, 1970 when account will be disabled ornull
if not set.getFlag()
Reserved for future use,null
if not set.The days after password expires that account is considered inactive and disabled ornull
if not set.The number of days until a password change is forced ornull
if not set.The number of days until a password change is allowed ornull
if not set.The encrypted password.The username the entry is for.The days before password is to expire that user is warned of pending password expiration ornull
if not set.setPassword
(String newPassword, Integer newChangedDate) Sets the encrypted password, optionally updating the changedDate.toString()
Gets thisShadowFile.Entry
as it would be written in/etc/shadow
, not including any newline.
-
Constructor Details
-
Entry
public Entry(User.Name username, String password, int changedDate, Integer minPasswordAge, Integer maxPasswordAge, Integer warningDays, Integer inactivateDays, Integer expirationDate, String flag) Constructs a shadow file entry given all the values. -
Entry
Creates a new shadow file entry for the given user and encrypted password. -
Entry
Creates a new shadow file entry for the given user.
-
-
Method Details
-
getCurrentDate
public static int getCurrentDate()Gets the number of days from the Epoch for the current day. -
getCurrentDate
public static int getCurrentDate(long time) Gets the number of days from the Epoch for the provided time in milliseconds from Epoch. -
toString
Gets thisShadowFile.Entry
as it would be written in/etc/shadow
, not including any newline. -
appendTo
Appends thisShadowFile.Entry
as it would be written in/etc/shadow
, not including any newline.- Throws:
IOException
- See Also:
-
getUsername
The username the entry is for. -
getPassword
The encrypted password. -
setPassword
Sets the encrypted password, optionally updating the changedDate.- Parameters:
newChangedDate
- The new changeDate ornull
to not alter- Returns:
- a new entry if the password changed or
this
when the password is the same
-
getChangedDate
public int getChangedDate()The days since Jan 1, 1970 password was last changed. -
getMinPasswordAge
The number of days until a password change is allowed ornull
if not set. -
getMaxPasswordAge
The number of days until a password change is forced ornull
if not set. -
getWarningDays
The days before password is to expire that user is warned of pending password expiration ornull
if not set. -
getInactivateDays
The days after password expires that account is considered inactive and disabled ornull
if not set. -
getExpirationDate
The days since Jan 1, 1970 when account will be disabled ornull
if not set. -
getFlag
Reserved for future use,null
if not set.
-