File tree Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 11VAULTSERVER=
22ISSUER=
3+ GROUPROLE=
4+ GROUPSUBPAT=
35HASKERBEROS=true
46#HASSSH=true
57ROBOTKEYTAB=
Original file line number Diff line number Diff line change 11htdestroytoken
2+ set -ex
23htgettoken --nokerberos --nossh -a $VAULTSERVER -i $ISSUER
4+ if [ -n "$GROUPSUBPAT" ]; then
5+ # also check the sub from oidc flow (others in test 014)
6+ htdecodetoken | jq -r .sub | grep -v $GROUPSUBPAT
7+ fi
Original file line number Diff line number Diff line change 1+ if [ -z "$GROUPSUBPAT" ]; then
2+ exit $SKIPCODE
3+ fi
4+ set -ex
5+ htgettoken --nokerberos --nooidc --nossh -a $VAULTSERVER -i $ISSUER --scopes="$TESTSCOPES"
6+ EXPTIME="$(htdecodetoken|jq -r .exp)"
7+
8+ # check sub for token exchange
9+ htgettoken --nossh -a $VAULTSERVER -i $ISSUER --scopes="$TESTSCOPES"
10+ htdecodetoken | jq -r .sub | grep -v $GROUPSUBPAT
11+
12+ # check sub for refresh
13+ # make sure that we don't request minsecs longer than the access token lifetime
14+ # by waiting a couple of seconds
15+ sleep 2
16+ NOW="$(date +%s)"
17+ let MINSECS=$EXPTIME-$NOW+1
18+ htgettoken --nooidc --nokerberos --nossh -a $VAULTSERVER -i $ISSUER --minsecs=$MINSECS
19+ EXPTIME2="$(htdecodetoken|jq -r .exp)"
20+ if [ "$EXPTIME" = "$EXPTIME2" ]; then
21+ echo "The access token was not renewed!"
22+ exit 1
23+ fi
24+ htdecodetoken | jq -r .sub | grep -v $GROUPSUBPAT
Original file line number Diff line number Diff line change 1+ if [ -z "$GROUPSUBPAT" ]; then
2+ exit $SKIPCODE
3+ fi
4+ set -ex
5+ # check sub for oidc flow with role
6+ htgettoken --nossh -a $VAULTSERVER -i $ISSUER -r $GROUPROLE
7+ htdecodetoken | jq -r .sub | grep $GROUPSUBPAT
8+ EXPTIME="$(htdecodetoken|jq -r .exp)"
9+
10+ # check sub for token exchange
11+ htgettoken --nossh -a $VAULTSERVER -i $ISSUER -r $GROUPROLE --scopes="$TESTSCOPES"
12+ htdecodetoken | jq -r .sub | grep $GROUPSUBPAT
13+
14+ # check sub for refresh
15+ # make sure that we don't request minsecs longer than the access token lifetime
16+ # by waiting a couple of seconds
17+ sleep 2
18+ NOW="$(date +%s)"
19+ let MINSECS=$EXPTIME-$NOW+1
20+ htgettoken --nooidc --nokerberos --nossh -a $VAULTSERVER -i $ISSUER -r $GROUPROLE --minsecs=$MINSECS
21+ EXPTIME2="$(htdecodetoken|jq -r .exp)"
22+ if [ "$EXPTIME" = "$EXPTIME2" ]; then
23+ echo "The access token was not renewed!"
24+ exit 1
25+ fi
26+ htdecodetoken | jq -r .sub | grep $GROUPSUBPAT
You can’t perform that action at this time.
0 commit comments