source: TI12-security/trunk/python/ndg.security.test/ndg/security/test/combinedservices/sessionmanager/usercertauthn.py @ 4464

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.test/ndg/security/test/combinedservices/sessionmanager/usercertauthn.py@4464
Revision 4464, 1.7 KB checked in by pjkersha, 12 years ago (diff)

Added a test deployment to try out Session Manager and Attribute Authority WSGIs running under the same Paste instance. Tested against Session Manager Client unit tests.

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 & NERC"
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 UserCertAuthN(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.