Skip to content

Commit

Permalink
#27: allow to turn off curl's certificate verification
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Flamm committed Jun 9, 2017
1 parent e627e6b commit d67d666
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ NAME=<your username> # optional
PW=<your password> # optional, I wouldn't put it here
PATTERN="${ACCOUNT}|${ROLE}" # optional, the message you want to see in front of the prompt
RENEW_INT=<custom token renew interval> # optional, defaults to token's expiry
INSECURE=<true|false> # optional, perform "insecure" SSL connections, defaults to false
```

Use option `--example-cfg` to create an example configuration file.
Expand Down
11 changes: 10 additions & 1 deletion afpre
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ variable_empty() {
[ -z "${1}" ]
}

variable_true() {
[ "${1}" = true ]
}

options_contain() {
grep -q -- "${1}" <<< "${@:2}"
}
Expand Down Expand Up @@ -102,6 +106,11 @@ variable_empty "${PW}" && {
echo
}

variable_true "${INSECURE}" && {
INSECURE_OPTION="--insecure"
echo WARNING: configured to perform \"insecure\" SSL connections and transfers
}

X1XBN02R=$(encode64 "${NAME}:${PW}")
RCFILE=$(mktemp)

Expand All @@ -122,7 +131,7 @@ error_msg() {
}
basic_auth() {
curl -f -s -H "Authorization: Basic \${2}" \${1}
curl -f -s ${INSECURE_OPTION} -H "Authorization: Basic \${2}" \${1}
}
json_value() {
Expand Down

0 comments on commit d67d666

Please sign in to comment.