comparison mod_auth_external/examples/bash/prosody-auth-example.sh @ 1164:b6280e8886f4

mod_auth_external: Move example scripts to new examples/ dir, and add Lua and Go examples
author Matthew Wild <mwild1@gmail.com>
date Thu, 15 Aug 2013 16:44:43 +0100
parents mod_auth_external/authorize_example.sh@2686221255cf
children 25641c4cab36
comparison
equal deleted inserted replaced
1163:52bee1247014 1164:b6280e8886f4
1 #!/bin/bash
2
3 IFS=":"
4 AUTH_OK=1
5 AUTH_FAILED=0
6 LOGFILE="/var/log/prosody/auth.log"
7 USELOG=true
8
9 while read ACTION USER HOST PASS ; do
10
11 [ $USELOG == true ] && { echo "Date: $(date) Action: $ACTION User: $USER Host: $HOST Pass: $PASS" >> $LOGFILE; }
12
13 case $ACTION in
14 "auth")
15 if [ $USER == "someone" ] ; then
16 echo $AUTH_OK
17 else
18 echo $AUTH_FAILED
19 fi
20 ;;
21 *)
22 echo $AUTH_FAILED
23 ;;
24 esac
25
26 done