File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
tests/008-minsecsexchange Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ # assumes vault token is already present and assumes any access token
2+ # cached in vault is not close to its expiration
3+ set -e
4+ # make sure there's an exchanged token
5+ htgettoken --nooidc --nokerberos --nossh -a $VAULTSERVER -i $ISSUER --scopes="$TESTSCOPES"
6+ EXPTIME="$(htdecodetoken|jq -r .exp)"
7+ # make sure that the same token is returned from cache the second try
8+ htgettoken --nooidc --nokerberos --nossh -a $VAULTSERVER -i $ISSUER --scopes="$TESTSCOPES"
9+ EXPTIME2="$(htdecodetoken|jq -r .exp)"
10+ if [ "$EXPTIME" != "$EXPTIME2" ]; then
11+ echo "The same token was not received twice from vault!"
12+ exit 1
13+ fi
14+ # make sure that we don't request minsecs longer than the access token lifetime
15+ # by waiting a couple of seconds
16+ sleep 2
17+ NOW="$(date +%s)"
18+ let MINSECS=$EXPTIME-$NOW+1
19+ htgettoken --nooidc --nokerberos --nossh -a $VAULTSERVER -i $ISSUER --minsecs=$MINSECS --scopes="$TESTSCOPES"
20+ EXPTIME3="$(htdecodetoken|jq -r .exp)"
21+ if [ "$EXPTIME" = "$EXPTIME3" ]; then
22+ echo "The access token was not renewed!"
23+ exit 1
24+ fi
You can’t perform that action at this time.
0 commit comments