Support base64 padding in federated tokens

Fernet tokens can have base64 padding, which gets urlencoded as one
or more "%3D" strings at the end of the token. This change expands the
parsing of tokens to support the % character.

Change-Id: I62ff7bd94b475cddbc3cfcc7782ce4ef3b65b268
This commit is contained in:
Miguel Grinberg 2015-09-15 18:32:08 -07:00 committed by Jesse Pretorius
parent ee6a360904
commit bcb291774e

View File

@ -72,7 +72,7 @@ if [ "$?" != "0" ]; then
echo "Could not obtain IdP token, did you forget to import your openrc file? See token.json and error.log for details."
exit 1
fi
IDP_TOKEN=`grep X-Subject-Token token.txt | grep -Po ': .*' | grep -Po '[a-zA-Z0-9-_]*'`
IDP_TOKEN=`grep X-Subject-Token token.txt | grep -Po ': .*' | grep -Po '[a-zA-Z0-9-_%]*'`
echo - Obtained IdP token.
# obtain the service provider URLs
@ -106,7 +106,7 @@ if [ "$?" != "0" ] || ! grep -q X-Subject-Token unscoped.txt; then
echo Could not obtain unscoped token from service provider. See unscoped.txt and error.log for details.
exit 1
fi
UNSCOPED_TOKEN=`grep X-Subject-Token unscoped.txt | grep -Po ': .*' | grep -Po '[a-zA-Z0-9-_]*'`
UNSCOPED_TOKEN=`grep X-Subject-Token unscoped.txt | grep -Po ': .*' | grep -Po '[a-zA-Z0-9-_%]*'`
echo - Obtained unscoped token from SP: $UNSCOPED_TOKEN
echo '- Domains available at sp: '