moby/integration-cli/fixtures/auth/docker-credential-shell-test
Aaron Lehmann ba0aa5311a Add support for identity tokens in client credentials store
Update unit test and documentation to handle the new case where Username
is set to <token> to indicate an identity token is involved.

Change the "Password" field in communications with the credential helper
to "Secret" to make clear it has a more generic purpose.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-03-09 13:47:57 -08:00

33 lines
753 B
Bash
Executable file

#!/bin/bash
set -e
case $1 in
"store")
in=$(</dev/stdin)
server=$(echo "$in" | jq --raw-output ".ServerURL" | sha1sum - | awk '{print $1}')
username=$(echo "$in" | jq --raw-output ".Username")
password=$(echo "$in" | jq --raw-output ".Secret")
echo "{ \"Username\": \"${username}\", \"Secret\": \"${password}\" }" > $TEMP/$server
;;
"get")
in=$(</dev/stdin)
server=$(echo "$in" | sha1sum - | awk '{print $1}')
if [[ ! -f $TEMP/$server ]]; then
echo "credentials not found in native keychain"
exit 1
fi
payload=$(<$TEMP/$server)
echo "$payload"
;;
"erase")
in=$(</dev/stdin)
server=$(echo "$in" | sha1sum - | awk '{print $1}')
rm -f $TEMP/$server
;;
*)
echo "unknown credential option"
exit 1
;;
esac