Skip to content

Commit

Permalink
fixes issue \#12 + doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
simonkowallik committed Jan 3, 2022
1 parent 080e366 commit 1e4f72d
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 21 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@ Password:
OK
```

Urlencoded credentials as an argument
JSON formatted credentials as an argument
```sh
simon@bigip ~ $ ihac-auth 'userid=simon%40example.com&passwd=MyP%40ssw0rd'
simon@bigip ~ $ ihac-auth '{"user_id": "simon@example.com", "user_secret": "MyP@ssw0rd"}'
OK
```

Urlencoded credentials via STDIN
JSON formatted credentials via STDIN
```sh
simon@bigip ~ $ cat $HOME/credentials.txt | ihac-auth
simon@bigip ~ $ cat $HOME/credentials.json | ihac-auth

simon@bigip ~ $ cat $HOME/credentials.txt
userid=simon%40example.com&passwd=MyP%40ssw0rd
simon@bigip ~ $ cat $HOME/credentials.json
{"user_id": "simon@example.com", "user_secret": "MyP@ssw0rd"}
```

De-authenticate / delete session cookies
Expand Down
13 changes: 7 additions & 6 deletions ihac-auth
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
if [[ ! -d "$HOME/.ihac" ]]; then mkdir "$HOME/.ihac"; fi
Expand Down Expand Up @@ -36,7 +36,7 @@ then
echo -n "Password: "
read -s password && echo
if [[ -z "$password" ]]; then echoerr "Error: need password to authenticate."; exit 1; fi
USRPW="userid=$(urlencode $username)&passwd=$(urlencode $password)"
USRPW="{\"user_id\": \"$username\", \"user_secret\": \"$password\"}"
else
if [[ "$1" == "delete" ]] || [[ "$1" == "--delete" ]] || [[ "$1" == "-d" ]] || [[ "$1" == "--logout" ]]
then
Expand All @@ -60,12 +60,13 @@ else
fi

result=`curl -si$IHACPROXY --user-agent "iHAC/$VERSION" --cookie-jar "$IHACAUTH" \
--data $USRPW \
-o - https://login.f5.com/resource/loginAction.jsp \
-H "Content-type: application/json" \
--data-ascii "$USRPW" \
-o - https://api.f5.com/auth/pub/sso/login/ihealth-api \
| sort -r \
| perl -ne 's/\r\n//g;
if(m/ssosession/gi) {print "OK";exit 0}
if(m/login.jsp/gi) {print "auth_failed";exit 0}'`
if(m/ssosession/gi) {print "OK";exit 0}
if(m/login.jsp/gi) {print "auth_failed";exit 0}'`

if [[ "$result" == "OK" ]]; then echo "OK"; exit 0; fi
if [[ "$result" == "auth_failed" ]]; then echoerr "Error: authentication failed."; exit 1; fi
Expand Down
2 changes: 1 addition & 1 deletion ihac-commandlist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down
2 changes: 1 addition & 1 deletion ihac-commandrun
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down
2 changes: 1 addition & 1 deletion ihac-diagnostics
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down
2 changes: 1 addition & 1 deletion ihac-fileget
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down
2 changes: 1 addition & 1 deletion ihac-filelist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down
2 changes: 1 addition & 1 deletion ihac-qkviewadd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down
2 changes: 1 addition & 1 deletion ihac-qkviewdelete
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down
2 changes: 1 addition & 1 deletion ihac-qkviewget
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down
2 changes: 1 addition & 1 deletion ihac-qkviewlist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#license: MIT
#author: Simon Kowallik <github simonkowallik.com>
#source: https://github.com/simonkowallik/iHAC
VERSION="3.1"
VERSION="3.2"
#
IHACAUTH="$HOME/.ihac/auth.jar"
IHACPROXYFILE="$HOME/.ihac/IHACPROXY"
Expand Down

0 comments on commit 1e4f72d

Please sign in to comment.