source: TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/integration/authz_lite/attributeinterface.py @ 7077

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/integration/authz_lite/attributeinterface.py@7077
Revision 7077, 1.6 KB checked in by pjkersha, 9 years ago (diff)
  • Property svn:keywords set to Id
Line 
1"""NDG Attribute Authority attribute interface class - acts as an interface
2between the data centre's user roles configuration and the Attribute Authority
3
4Use an alternative config here to
5ndg.security.test.config.attributeauthority.sitea.siteAUserRoles.TestUserRoles
6to test multi user access
7                                                                               
8NERC DataGrid Project
9"""
10__author__ = "P J Kershaw"
11__date__ = "01/07/2009"
12__copyright__ = "(C) 2009 Science and Technology Facilities Council"
13__license__ = "BSD - see LICENSE file in top-level directory"
14__contact__ = "Philip.Kershaw@stfc.ac.uk"
15__revision__ = '$Id$'
16from ndg.security.server.attributeauthority import AttributeInterface
17
18class TestUserRoles(AttributeInterface):
19    """Test User Roles class dynamic import for Attribute Authority"""
20
21    def __init__(self, propertiesFilePath=None):
22        pass
23
24    def getRoles(self, userId):
25        # 'test' user is for SSL client based authentication where the test
26        # certificate DN has a Common Name = test
27        if userId.endswith("/openid/PhilipKershaw"):
28            return [
29                'urn:siteA:security:authz:1.0:attr:postdoc',
30                'urn:siteA:security:authz:1.0:attr:staff', 
31                'urn:siteA:security:authz:1.0:attr:undergrad', 
32                'urn:siteA:security:authz:1.0:attr:coapec'
33            ]
34        elif userId == 'test':
35            return [
36                'urn:siteA:security:authz:1.0:attr:staff', 
37            ]
38        else:
39            return ['urn:siteA:security:authz:1.0:attr:guest']
Note: See TracBrowser for help on using the repository browser.