Adding GUI login/logout capability using form-based login.

Adding REST API login capability using basic authentication.

HTTP to HTTPS redirect is suppressed for now.

Change-Id: I1a98bdc5576c515e1aa5a1b8d66402af0c0bf8c8
diff --git a/tools/package/bin/onos-secure-ssh b/tools/package/bin/onos-secure-ssh
index 6c46904..ac94de5 100755
--- a/tools/package/bin/onos-secure-ssh
+++ b/tools/package/bin/onos-secure-ssh
@@ -7,6 +7,17 @@
 
 set -e
 
+# Scan argument for user/password or other options...
+while getopts u:p: o; do
+    case "$o" in
+        u) user=$OPTARG;;
+        p) password=$OPTARG;;
+    esac
+done
+password=${password:-user} # password defaults to the user name if not specified
+let OPC=$OPTIND-1
+shift $OPC
+
 cd $(dirname $0)/../apache-karaf-*/etc
 USERS=users.properties
 KEYS=keys.properties
@@ -18,5 +29,10 @@
 # Remove any previous known keys for the local host.
 ssh-keygen -f "$HOME/.ssh/known_hosts" -R [localhost]:8101
 
-# Swap the onos client to use the SSH variant
+# Swap the onos client to use the SSH variant.
 ln -s $(dirname $0)/onos-ssh $(dirname $0)/onos
+
+# If user and password options were given, setup the user/password.
+if [ -n "$user" -a -n "$password" ]; then
+    echo "$user = $password,_g_:admingroup" >> $USERS
+fi
\ No newline at end of file