source: TI12-security/trunk/python/ndg.security.server/ndg/security/server/templates/default_deployment/+package+/sessionmanager/userx509certauthn.py_tmpl @ 4684

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.server/ndg/security/server/templates/default_deployment/+package+/sessionmanager/userx509certauthn.py_tmpl@4684
Revision 4684, 1.7 KB checked in by pjkersha, 11 years ago (diff)
  • paster template - default_project -> default_deployment
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) 2008 STFC"
10__license__ = \
11"""This software may be distributed under the terms of the Q Public
12License, version 1.0 or later."""
13__contact__ = "Philip.Kershaw@stfc.ac.uk"
14__revision__ = '$Id: $'
15import logging
16log = logging.getLogger(__name__)
17import hashlib
18
19from ndg.security.server.sessionmanager import SessionManager, \
20    AbstractAuthNService, AuthNServiceInvalidCredentials, AuthNServiceError
21from ndg.security.common.myproxy import MyProxyClient
22
23class UserX509CertAuthN(AbstractAuthNService):
24    '''Test Authentication interface to the Session Manager
25    returning a certificate and private key
26   
27    For use with SessionManager unittests only'''
28   
29    def __init__(self, **prop):
30        '''Instantiate client object from X.509 cert and private key file path
31        inputs.  Private key must be none password protected.'''
32        self.userX509Cert = open(prop['userX509CertFilePath']).read()
33        self.userPriKey = open(prop['userPriKeyFilePath']).read()
34       
35    def logon(self, username, passphrase):
36        '''Implementation of AbstractAuthNService logon for Session Manager
37        unittests.  TEST ONLY - no check is carried out on username/passphrase
38        credentials
39       
40        @type username: basestring
41        @param username: username for account login
42        @type passphrase: basestring
43        @param passphrase: passphrase (or password) for user account
44        @rtype: tuple
45        @return: user PKI credentials.
46        '''
47       
48        return self.userX509Cert, self.userPriKey
Note: See TracBrowser for help on using the repository browser.