Skip to content

Commit

Permalink
Revision 2
Browse files Browse the repository at this point in the history
  • Loading branch information
pbowden-msft authored Mar 25, 2021
1 parent da5291b commit a44de80
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ADALCache_Age.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ SetHomeFolder() {
LoggedInUser=$(GetLoggedInUser)
SetHomeFolder "$LoggedInUser"

# Find out if the login.keychain is in the path - if not, add it
KeychainHasLogin=$(/usr/bin/sudo -u $LoggedInUser /usr/bin/security list-keychains | grep 'login.keychain')
if [ "$KeychainHasLogin" = "" ]; then
/usr/bin/sudo -u $LoggedInUser /usr/bin/security list-keychains -s "$HOME/Library/Keychains/login.keychain-db"
fi
# Search the keychain of the logged in user
/usr/bin/security list-keychains -s "$HOME/Library/Keychains/login.keychain-db"

# Get today's date in the 8-digit format of YYYYMMDD
DateToday=$(date "+%Y%m%d")

# Get the creation date of the keychain entry
KeychainCreationDate=$(/usr/bin/sudo -u $LoggedInUser /usr/bin/security find-generic-password -l 'com.microsoft.adalcache' | grep 'cdat' | cut -d '"' -f4)
KeychainCreationDate=$(/usr/bin/security find-generic-password -l 'com.microsoft.adalcache' | grep 'cdat' | cut -d '"' -f4)

# Trim the keychain date into the 8-digit format of YYMMDD
TrimmedCreationDate=${KeychainCreationDate:0:8}
Expand Down

0 comments on commit a44de80

Please sign in to comment.