Changeset 8082


Ignore:
Timestamp:
01/08/12 16:53:58 (8 years ago)
Author:
pjkersha
Message:
  • Fixed client shell scripts so that they work with BSD version of getopt. This does not support long option names so the syntax has had to be changed accordingly.
  • Fix to app.py to use MyProxyLogonWSMiddleware
Location:
trunk/MyProxyWebService/myproxy/ws
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MyProxyWebService/myproxy/ws/client/myproxy-ws-get-trustroots-wget.sh

    r7941 r8082  
    1313# $Id$ 
    1414cmdname=$(basename $0) 
    15 cmdline_opt=`getopt -o hU:bc: --long help,uri:,bootstrap,ca-directory: -n "$cmdname" -- "$@"` 
     15cmdline_opt=`getopt hU:bc: $*` 
    1616 
    1717usage="Usage: $cmdname [-h][-U get trust roots URI][-b][-c CA directory]\n 
    1818\n 
    1919   Options\n 
    20        -h | --help\t\t\t\tDisplays usage and quits.\n 
    21        -U | --uri <uri>\t\t\tMyProxy web service URI\n 
    22        -b | --bootstrap\t\t\tbootstrap trust in the MyProxy Server\n 
    23        -c | --ca-directory <directory path>\tDirectory to store the trusted\n 
    24        \t\t\t\t\tCA (Certificate Authority) certificates.  Defaults to\n  
    25        \t\t\t\t\t${HOME}/.globus/certificates or\n 
    26        \t\t\t\t\t/etc/grid-security/certificates if running as root.\n 
     20       -h\t\t\tDisplays usage and quits.\n 
     21       -U <uri>\t\tMyProxy web service URI\n 
     22       -b\t\t\tbootstrap trust in the MyProxy Server\n 
     23       -c <directory path>\tDirectory to store the trusted CA (Certificate Authority) certificates.\n 
     24       \t\t\tDefaults to ${HOME}/.globus/certificates or\n 
     25       \t\t\t/etc/grid-security/certificates if running as root.\n 
    2726" 
    2827 
     
    3231fi 
    3332 
    34 eval set -- "$cmdline_opt" 
     33set -- $cmdline_opt 
    3534 
    3635while true ; do 
    3736    case "$1" in 
    38         -h|--help) echo -e $usage ; exit 0 ;; 
    39         -U|--uri) uri=$2 ; shift 2 ;; 
    40         -b|--bootstrap) bootstrap=1 ; shift 1 ;; 
    41         -c|--ca-directory) cadir=$2 ; shift 2 ;; 
     37        -h) echo -e $usage ; exit 0 ;; 
     38        -U) uri=$2 ; shift 2 ;; 
     39        -b) bootstrap=1 ; shift 1 ;; 
     40        -c) cadir=$2 ; shift 2 ;; 
    4241         --) shift ; break ;; 
    4342        *) echo "Error parsing command line" ; exit 1 ;; 
  • trunk/MyProxyWebService/myproxy/ws/client/myproxy-ws-get-trustroots.sh

    r7923 r8082  
    1313# $Id$ 
    1414cmdname=$(basename $0) 
    15 cmdline_opt=`getopt -o hU:bc: --long help,uri:,bootstrap,ca-directory: -n "$cmdname" -- "$@"` 
     15cmdline_opt=`getopt hU:bc: $*` 
    1616 
    1717usage="Usage: $cmdname [-h][-U get trust roots URI][-b][-c CA directory]\n 
    1818\n 
    1919   Options\n 
    20        -h | --help\t\t\t\tDisplays usage and quits.\n 
    21        -U | --uri <uri>\t\t\tMyProxy web service URI\n 
    22        -b | --bootstrap\t\t\tbootstrap trust in the MyProxy Server\n 
    23        -c | --ca-directory <directory path>\tDirectory to store the trusted\n 
    24        \t\t\t\t\tCA (Certificate Authority) certificates.  Defaults to\n  
    25        \t\t\t\t\t${HOME}/.globus/certificates or\n 
    26        \t\t\t\t\t/etc/grid-security/certificates if running as root.\n 
     20       -h\t\t\tDisplays usage and quits.\n 
     21       -U <uri>\t\tMyProxy web service URI\n 
     22       -b\t\t\tbootstrap trust in the MyProxy Server\n 
     23       -c <directory path>\tDirectory to store the trusted CA (Certificate Authority) certificates.\n 
     24       \t\t\tDefaults to ${HOME}/.globus/certificates or\n 
     25       \t\t\t/etc/grid-security/certificates if running as root.\n 
    2726" 
    2827 
     
    3231fi 
    3332 
    34 eval set -- "$cmdline_opt" 
     33set -- $cmdline_opt 
    3534 
    3635while true ; do 
     36    echo "dollar one = $1" 
    3737    case "$1" in 
    38         -h|--help) echo -e $usage ; exit 0 ;; 
    39         -U|--uri) uri=$2 ; shift 2 ;; 
    40         -b|--bootstrap) bootstrap=1 ; shift 1 ;; 
    41         -c|--ca-directory) cadir=$2 ; shift 2 ;; 
     38        -h) echo -e $usage ; exit 0 ;; 
     39        -U) uri=$2 ; shift 2 ;; 
     40        -b) bootstrap=1 ; shift 1 ;; 
     41        -c) cadir=$2 ; shift 2 ;; 
    4242         --) shift ; break ;; 
    4343        *) echo "Error parsing command line" ; exit 1 ;; 
  • trunk/MyProxyWebService/myproxy/ws/client/myproxy-ws-logon-wget.sh

    r8015 r8082  
    1212# $Id$ 
    1313cmdname=$(basename $0) 
    14 cmdline_opt=`getopt -o hU:l:So:c: --long help,uri:,username:,stdin_pass,out:ca-directory: -n "$cmdname" -- "$@"` 
     14cmdline_opt=`getopt hU:l:So:c: $*` 
    1515 
    1616usage="Usage: $cmdname [-U MyProxy Web Service URI][-l username] ...\n 
    1717\n 
    1818   Options\n 
    19        -h | --help\t\t\t\tDisplays usage\n 
    20        -U | --uri\t\t<uri>\t\tMyProxy web service URI\n 
    21        -l | --username\t<username>\tUsername for the delegated proxy (defaults to \$LOGNAME)\n 
    22        -S | --stdin_pass\t\t\tpass password from stdin rather prompt from tty\n 
    23        -o | --out\t\t<filepath>\tLocation of delegated proxy (default to stdout)\n 
    24        -c | --ca-directory <directory path>\tDirectory containing the trusted\n 
    25        \t\t\t\t\tCA (Certificate Authority) certificates.  These are used to\n 
    26        \t\t\t\t\tverify the identity of the MyProxy Web Service.  Defaults to\n  
    27        \t\t\t\t\t${HOME}/.globus/certificates or\n 
    28        \t\t\t\t\t/etc/grid-security/certificates if running as root.\n 
     19       -h\t\t\tDisplays usage\n 
     20       -U <uri>\t\tMyProxy web service URI\n 
     21       -l <username>\t\tUsername for the delegated proxy (defaults to \$LOGNAME)\n 
     22       -S\t\t\tpass password from stdin rather prompt from tty\n 
     23       -o <filepath>\t\tOutput location of end entity certificate or delegated proxy (default to stdout)\n 
     24       -c <directory path>\tDirectory containing the trusted CA (Certificate Authority) certificates.  These are used to\n 
     25       \t\t\tverify the identity of the MyProxy Web Service.  Defaults to\n  
     26       \t\t\t${HOME}/.globus/certificates or\n 
     27       \t\t\t/etc/grid-security/certificates if running as root.\n 
    2928" 
     29 
    3030 
    3131if [ $? != 0 ] ; then 
     
    3434fi 
    3535 
    36 eval set -- "$cmdline_opt" 
     36set -- $cmdline_opt 
    3737 
    3838while true ; do 
    3939    case "$1" in 
    40         -h|--help) echo -e $usage ; exit 0 ;; 
    41         -U|--uri) uri=$2 ; shift 2 ;; 
    42         -l|--username) username=$2 ; shift 2 ;; 
    43         -S|--stdin_pass) stdin_pass=True ; shift 1 ;; 
    44         -o|--out) outfilepath=$2 ; shift 2 ;; 
    45         -c|--ca-directory) cadir=$2 ; shift 2 ;; 
     40        -h) echo -e $usage ; exit 0 ;; 
     41        -U) uri=$2 ; shift 2 ;; 
     42        -l) username=$2 ; shift 2 ;; 
     43        -S) stdin_pass=True ; shift 1 ;; 
     44        -o) outfilepath=$2 ; shift 2 ;; 
     45        -c) cadir=$2 ; shift 2 ;; 
    4646        --) shift ; break ;; 
    4747        *) echo "Error parsing command line" ; exit 1 ;; 
  • trunk/MyProxyWebService/myproxy/ws/client/myproxy-ws-logon.sh

    r8014 r8082  
    1212# $Id$ 
    1313cmdname=$(basename $0) 
    14 cmdline_opt=`getopt -o hU:l:So:c: --long help,uri:,username:,stdin_pass,out:ca-directory: -n "$cmdname" -- "$@"` 
     14cmdline_opt=`getopt hU:l:So:c: $*` 
    1515 
    1616usage="Usage: $cmdname [-U MyProxy Web Service URI][-l username] ...\n 
    1717\n 
    1818   Options\n 
    19        -h | --help\t\t\t\tDisplays usage\n 
    20        -U | --uri\t\t<uri>\t\tMyProxy web service URI\n 
    21        -l | --username\t<username>\tUsername for the delegated proxy (defaults to \$LOGNAME)\n 
    22        -S | --stdin_pass\t\t\tpass password from stdin rather prompt from tty\n 
    23        -o | --out\t\t<filepath>\tLocation of delegated proxy (default to stdout)\n 
    24        -c | --ca-directory <directory path>\tDirectory containing the trusted\n 
    25        \t\t\t\t\tCA (Certificate Authority) certificates.  These are used to\n 
    26        \t\t\t\t\tverify the identity of the MyProxy Web Service.  Defaults to\n  
    27        \t\t\t\t\t${HOME}/.globus/certificates or\n 
    28        \t\t\t\t\t/etc/grid-security/certificates if running as root.\n 
     19       -h\t\t\tDisplays usage\n 
     20       -U <uri>\t\tMyProxy web service URI\n 
     21       -l <username>\t\tUsername for the delegated proxy (defaults to \$LOGNAME)\n 
     22       -S\t\t\tpass password from stdin rather prompt from tty\n 
     23       -o <filepath>\t\tOutput location of end entity certificate or delegated proxy (default to stdout)\n 
     24       -c <directory path>\tDirectory containing the trusted CA (Certificate Authority) certificates.  These are used to\n 
     25       \t\t\tverify the identity of the MyProxy Web Service.  Defaults to\n  
     26       \t\t\t${HOME}/.globus/certificates or\n 
     27       \t\t\t/etc/grid-security/certificates if running as root.\n 
    2928" 
    3029 
     
    3433fi 
    3534 
    36 eval set -- "$cmdline_opt" 
     35set -- $cmdline_opt 
    3736 
    3837while true ; do 
    3938    case "$1" in 
    40         -h|--help) echo -e $usage ; exit 0 ;; 
    41         -U|--uri) uri=$2 ; shift 2 ;; 
    42         -l|--username) username=$2 ; shift 2 ;; 
    43         -S|--stdin_pass) stdin_pass=True ; shift 1 ;; 
    44         -o|--out) outfilepath=$2 ; shift 2 ;; 
    45         -c|--ca-directory) cadir=$2 ; shift 2 ;; 
     39        -h) echo -e $usage ; exit 0 ;; 
     40        -U) uri=$2 ; shift 2 ;; 
     41        -l) username=$2 ; shift 2 ;; 
     42        -S) stdin_pass=True ; shift 1 ;; 
     43        -o) outfilepath=$2 ; shift 2 ;; 
     44        -c) cadir=$2 ; shift 2 ;; 
    4645        --) shift ; break ;; 
    4746        *) echo "Error parsing command line" ; exit 1 ;; 
  • trunk/MyProxyWebService/myproxy/ws/server/wsgi/app.py

    r7769 r8082  
    1010__revision__ = "$Id: $" 
    1111from myproxy.ws.server.wsgi.httpbasicauth import HttpBasicAuthMiddleware 
    12 from myproxy.ws.server.wsgi.middleware import (MyProxyClientMiddleware, 
    13                                             MyProxyGetTrustRootsMiddleware) 
     12from myproxy.ws.server.wsgi.middleware import (MyProxyLogonWSMiddleware, 
     13                                               MyProxyGetTrustRootsMiddleware) 
    1414      
    1515         
     
    6060         
    6161        # Middleware to hold a MyProxy client and expose interface in environ 
    62         app = MyProxyClientMiddleware.filter_app_factory(getTrustRootsMWare,  
    63                                                          global_conf,  
    64                                                          prefix=prefix, 
    65                                                          **app_conf) 
     62        app = MyProxyLogonWSMiddleware.filter_app_factory(getTrustRootsMWare,  
     63                                                          global_conf,  
     64                                                          prefix=prefix, 
     65                                                          **app_conf) 
    6666         
    6767        # Set HTTP Basic Auth to use the MyProxy client logon for its 
  • trunk/MyProxyWebService/myproxy/ws/server/wsgi/middleware.py

    r7916 r8082  
    9595         
    9696        # Call parent version 
    97         super(MyProxyLogonWSMiddleware, self).parseConfig(prefix=PARAM_PREFIX,  
     97        super(MyProxyLogonWSMiddleware, self).parseConfig(prefix=prefix,  
    9898                            myProxyClientPrefix=myProxyClientPrefix, **app_conf)   
    9999             
  • trunk/MyProxyWebService/myproxy/ws/test/__init__.py

    r8072 r8082  
    99import os 
    1010 
    11 test_dir = os.path.basename(__file__) 
     11test_dir = os.path.dirname(__file__) 
     12myproxy_ws_pkg_dir = os.path.dirname(test_dir) 
    1213test_ca_dir = os.path.join(test_dir, 'ca') 
     14client_shell_scripts_dir = os.path.join(myproxy_ws_pkg_dir, 'client') 
     15logon_shell_script = 'myproxy-ws-logon.sh' 
     16get_trustroots_shell_script = 'myproxy-ws-get-trustroots.sh' 
     17logon_shell_script_path = os.path.join(client_shell_scripts_dir, 
     18                                       logon_shell_script) 
     19get_trustroots_shell_script_path = os.path.join(client_shell_scripts_dir, 
     20                                                get_trustroots_shell_script) 
     21 
  • trunk/MyProxyWebService/myproxy/ws/test/test_client.py

    r8072 r8082  
    99from myproxy.ws.test import test_ca_dir 
    1010 
    11 class TestWSClient(unittest.TestCase): 
     11class WSClientTestCase(unittest.TestCase): 
     12    """Test MyProxy Web Service Client""" 
     13     
    1214    def test_logon(self): 
    1315        myproxy_client = MyProxyWSClient() 
    1416        myproxy_client.ca_cert_dir = test_ca_dir 
    1517         
    16         myproxy_server_url = 'https://myproxy.ceda.ac.uk/logon' 
    17         username = 'pjkersha' 
     18        myproxy_server_url = 'https://localhost/logon' 
     19        username = 'testuser' 
    1820        password = '' 
    1921        res = myproxy_client.logon(username, password, myproxy_server_url) 
  • trunk/MyProxyWebService/myproxy/ws/test/test_httpbasicauth.py

    r7769 r8082  
    88__contact__ = "Philip.Kershaw@stfc.ac.uk" 
    99__revision__ = '$Id: $' 
    10 import logging 
    11  
    1210import unittest 
    1311import os 
  • trunk/MyProxyWebService/myproxy/ws/test/test_myproxywsgi_with_paster.py

    r8072 r8082  
    2323from OpenSSL import SSL, crypto 
    2424 
     25from myproxy.ws.test import (test_ca_dir, logon_shell_script_path, 
     26                             get_trustroots_shell_script_path) 
    2527from myproxy.ws.test.server_utils import PasteDeployAppServer 
    2628         
     
    3234    THIS_DIR = path.abspath(path.dirname(__file__)) 
    3335    CA_DIRNAME = 'ca' 
    34     CA_DIR = path.join(THIS_DIR, CA_DIRNAME) 
     36    CA_DIR = test_ca_dir 
    3537    CA_ENV_VARNAME = 'X509_CERT_DIR' 
    3638     
     
    4850 
    4951    SERVICE_PORTNUM = 10443 
    50     LOGON_SCRIPT_CMD = 'myproxy-ws-logon.sh' 
    51     LOGON_SCRIPT_USER_OPTNAME = '--username' 
    52     LOGON_SCRIPT_STDIN_PASS_OPTNAME = '--stdin_pass' 
     52    LOGON_SCRIPT_CMD = logon_shell_script_path 
     53    LOGON_SCRIPT_USER_OPTNAME = '-l' 
     54    LOGON_SCRIPT_STDIN_PASS_OPTNAME = '-S' 
    5355     
    54     SCRIPT_URI_OPTNAME = '--uri' 
     56    SCRIPT_URI_OPTNAME = '-U' 
    5557     
    56     GET_TRUSTROOTS_SCRIPT_CMD = 'myproxy-ws-get-trustroots.sh' 
    57     GET_TRUSTROOTS_SCRIPT_BOOTSTRAP_OPTNAME = '--bootstrap' 
     58    GET_TRUSTROOTS_SCRIPT_CMD = get_trustroots_shell_script_path 
     59    GET_TRUSTROOTS_SCRIPT_BOOTSTRAP_OPTNAME = '-b' 
    5860     
    5961    def __init__(self, *arg, **kw): 
     
    196198if __name__ == "__main__": 
    197199    unittest.main()         
    198         
Note: See TracChangeset for help on using the changeset viewer.