source: TI12-security/trunk/NDGSecurity/python/ndg_security_server/ndg/security/server/paster_templates/full_deployment/sessionmanager/userx509certauthn.py @ 7077

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/ndg_security_server/ndg/security/server/paster_templates/full_deployment/sessionmanager/userx509certauthn.py@7077
Revision 7077, 1.7 KB checked in by pjkersha, 9 years ago (diff)
  • Property svn:keywords set to Id
Line 
1"""
2Session Manager Authentication interface returning a user cert/private key -
3for use with Session Manager unittests
4
5NERC Data Grid Project
6"""
7__author__ = "P J Kershaw"
8__date__ = "29/10/08"
9__copyright__ = "(C) 2009 Science and Technology Facilities Council"
10__license__ = "BSD - see LICENSE file in top-level directory"
11__contact__ = "Philip.Kershaw@stfc.ac.uk"
12__revision__ = '$Id$'
13import logging
14log = logging.getLogger(__name__)
15
16from ndg.security.server.sessionmanager import SessionManager, \
17    AbstractAuthNService, AuthNServiceInvalidCredentials, AuthNServiceError
18from ndg.security.common.myproxy import MyProxyClient
19
20class UserX509CertAuthN(AbstractAuthNService):
21    '''Test Authentication interface to the Session Manager
22    returning a certificate and private key
23   
24    For use with SessionManager unittests only'''
25   
26    def __init__(self, **prop):
27        '''Instantiate client object from X.509 cert and private key file path
28        inputs.  Private key must be none password protected.'''
29        self.userX509Cert = open(prop['userX509CertFilePath']).read()
30        self.userPriKey = open(prop['userPriKeyFilePath']).read()
31       
32    def logon(self, username, passphrase):
33        '''Implementation of AbstractAuthNService logon for Session Manager
34        unittests.  TEST ONLY - no check is carried out on username/passphrase
35        credentials
36       
37        @type username: basestring
38        @param username: username for account login
39        @type passphrase: basestring
40        @param passphrase: passphrase (or password) for user account
41        @rtype: tuple
42        @return: user PKI credentials.
43        '''
44       
45        return self.userX509Cert, self.userPriKey
Note: See TracBrowser for help on using the repository browser.