Changeset 4501


Ignore:
Timestamp:
27/11/08 12:18:11 (11 years ago)
Author:
pjkersha
Message:

New ndg.security.server.wsgi.utils package to hold Session Manager and Attribute Authority client wrappers. These check environ for a local SM/AA instance or call a remote service if a URI is given.

  • Added a test for Combined Services unit test to try out a Session Manager connect using the new wrapper.
Location:
TI12-security/trunk/python
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/sessionmanager.py

    r4480 r4501  
    380380             
    381381            except Exception, e: 
    382                 raise SessionManagerClientError, "Pass-phrase not defined: " + \ 
    383                                              str(e) 
     382                raise SessionManagerClientError("Pass-phrase not defined: %s" % 
     383                                                e) 
    384384 
    385385        # Make connection 
     
    389389        # M2Crypto private key load 
    390390        return tuple([isinstance(i,unicode) and str(i) or i for i in res]) 
     391     
    391392     
    392393    def disconnect(self, userCert=None, sessID=None): 
     
    411412        # Make connection 
    412413        self.__srv.disconnect(userCert, sessID) 
    413      
     414 
     415 
    414416    def getSessionStatus(self, userDN=None, sessID=None): 
    415417        """Check for the existence of a session with a given 
     
    442444        # Make connection 
    443445        return self.__srv.getSessionStatus(userDN, sessID) 
     446 
    444447 
    445448    def getAttCert(self, 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/combinedservices/serverapp.py

    r4479 r4501  
    1414__revision__ = "$Id$" 
    1515import os 
     16from ndg.security.server.wsgi.utils.sessionmanagerclient import \ 
     17    WSGISessionManagerClient 
     18     
     19class InfoApp(object): 
     20    method = { 
     21        "/": 'default', 
     22        "/test_connect": "test_connect" 
     23    } 
     24     
     25    def __call__(self, environ, start_response): 
     26         
     27        methodName = self.method.get(environ['PATH_INFO'], '').rstrip() 
     28        if methodName: 
     29            action = getattr(self, methodName) 
     30            return action(environ, start_response) 
     31        else: 
     32            start_response('404 Not Found', [('Content-type', 'text/plain')]) 
     33            return "NDG Security Combined Services Unit tests: invalid URI" 
     34             
     35    def default(self, environ, start_response): 
     36        start_response('200 OK', [('Content-type', 'text/plain')]) 
     37        return "NDG Security Combined Services Unit Tests" 
    1638 
    17 def infoApp(environ, start_response): 
    18     start_response('200 OK', [('Content-type', 'text/plain')]) 
    19     return "NDG Security Services Unit Tests" 
    20  
     39    def test_connect(self, environ, start_response): 
     40         
     41        client = WSGISessionManagerClient(environ=environ) 
     42        res = client.connect("testuser", passphrase="testpassword") 
     43        start_response('200 OK', [('Content-type', 'text/plain')]) 
     44        return "test_connect succeeded" 
     45         
    2146def app_factory(global_config, **local_conf): 
    22     return infoApp 
     47    return InfoApp() 
    2348 
    2449 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/combinedservices/services.ini

    r4480 r4501  
    178178enableWSDLQuery = True 
    179179charset = utf-8 
     180filterID = ndg.security.server.sessionmanager.SessionManager 
    180181 
    181182[filter:wsseSignatureVerificationFilter] 
Note: See TracChangeset for help on using the changeset viewer.