summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/hosting/server/get-auth
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/trunk/hosting/server/get-auth')
-rwxr-xr-xsca-cpp/trunk/hosting/server/get-auth52
1 files changed, 25 insertions, 27 deletions
diff --git a/sca-cpp/trunk/hosting/server/get-auth b/sca-cpp/trunk/hosting/server/get-auth
index 2be546f91f..9084f32687 100755
--- a/sca-cpp/trunk/hosting/server/get-auth
+++ b/sca-cpp/trunk/hosting/server/get-auth
@@ -18,44 +18,42 @@
# under the License.
here=`echo "import os; print os.path.realpath('$0')" | python`; here=`dirname $here`
-mkdir -p $1
+mkdir -p $1/conf
root=`echo "import os; print os.path.realpath('$1')" | python`
admin=$2
apass=$3
-user=$4
+email=$4
+host=$5
httpd_prefix=`cat $here/../../modules/http/httpd.prefix`
-conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
-
-sslconf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
-if [ "$sslconf" = "" ]; then
- scheme="http"
- addr=`echo $conf | awk '{ print $7 }'`
- host=`$here/../../modules/http/httpd-addr ip $addr`
- if [ "$host" = "" ]; then
- host="localhost"
+if [ "$host" = "" ]; then
+ conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+ sslconf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
+ if [ "$sslconf" = "" ]; then
+ scheme="http"
+ addr=`echo $conf | awk '{ print $7 }'`
+ host=`$here/../../modules/http/httpd-addr ip $addr`
+ if [ "$host" = "" ]; then
+ host="localhost"
+ fi
+ port=`$here/../../modules/http/httpd-addr port $addr`
+ else
+ scheme="https"
+ ssladdr=`echo $sslconf | awk '{ print $6 }'`
+ host=`$here/../../modules/http/httpd-addr ip $ssladdr`
+ if [ "$host" = "" ]; then
+ host="localhost"
+ fi
+ port=`$here/../../modules/http/httpd-addr port $ssladdr`
fi
- port=`$here/../../modules/http/httpd-addr port $addr`
else
scheme="https"
- ssladdr=`echo $sslconf | awk '{ print $6 }'`
- host=`$here/../../modules/http/httpd-addr ip $ssladdr`
- if [ "$host" = "" ]; then
- host="localhost"
- fi
- port=`$here/../../modules/http/httpd-addr port $ssladdr`
+ port="443"
fi
-# Compute user id
-slash=`echo $user | grep "/"`
-if [ "$slash" = "" ]; then
- id="\"$user\""
- upath=$user
-else
- id=`echo $user | awk -F "/" '{ printf "\"%s\" \"%s\"", $2, $3 }'`
- upath=`echo $user | awk -F "/" '{ printf "%s/%s", $2, $3 }'`
-fi
+# Compute user URI
+upath=$email
# Get user auth
curl -k -L -u $admin:$apass -H "X-Forwarded-Server: $host" $scheme://$host:$port/c/Authenticator/$upath