- Timestamp:
- 13/07/10 09:32:09 (11 years ago)
- Location:
- TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/config/attributeauthority/sitea/site-a.ini
r7077 r7164 54 54 # SAML SOAP Binding to the Attribute Authority 55 55 [filter:AttributeAuthoritySamlSoapBindingFilter] 56 paste.filter_app_factory = ndg.s ecurity.server.wsgi.saml:SOAPQueryInterfaceMiddleware.filter_app_factory56 paste.filter_app_factory = ndg.saml.saml2.binding.soap.server.wsgi.queryinterface:SOAPQueryInterfaceMiddleware.filter_app_factory 57 57 prefix = saml.soapbinding. 58 58 … … 62 62 saml.soapbinding.serialise = ndg.security.common.saml_utils.esg.xml.etree:EsgResponseElementTree.toXML 63 63 64 saml.soapbinding. pathMatchList= /AttributeAuthority64 saml.soapbinding.mountPath = /AttributeAuthority 65 65 saml.soapbinding.queryInterfaceKeyName = %(attributeQueryInterfaceEnvironKeyName)s 66 66 -
TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/attributeauthorityclient/test_samlattributeauthorityclient.cfg
r7077 r7164 49 49 50 50 [test07AttributeQuerySslSOAPBindingInterface] 51 uri = http ://localhost:5000/AttributeAuthority/51 uri = https://localhost:5443/AttributeAuthority/ 52 52 subject = https://openid.localhost/philip.kershaw 53 53 … … 62 62 attributeQuery.sslCertFilePath = $NDGSEC_TEST_CONFIG_DIR/pki/test.crt 63 63 attributeQuery.sslPriKeyFilePath = $NDGSEC_TEST_CONFIG_DIR/pki/test.key 64 attributeQuery.sslValidDNs = / C=UK/ST=Oxfordshire/O=BADC/OU=Security/CN=localhost, /O=Site A/CN=Attribute Authority64 attributeQuery.sslValidDNs = /O=NDG/OU=Security/CN=localhost, /O=Site A/CN=Attribute Authority 65 65 -
TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/wsgi/authz/saml-test.ini
r7077 r7164 19 19 20 20 [filter:AuthZFilter] 21 paste.filter_app_factory=ndg.security.server.wsgi.authz :SAMLAuthorizationMiddleware.filter_app_factory22 prefix = authz.21 paste.filter_app_factory=ndg.security.server.wsgi.authz.pep:SamlPepMiddleware.filter_app_factory 22 prefix = pep. 23 23 policy.filePath = %(here)s/saml-policy.xml 24 24 25 authz.pepResultHandler = ndg.security.test.unit.wsgi.authz.test_authz.RedirectFollowingAccessDenied 25 pep.authzServiceURI = https://localhost:9443/AuthorisationService 26 27 pep.pepResultHandler = ndg.security.test.unit.wsgi.authz.test_authz.RedirectFollowingAccessDenied 26 28 27 29 # Settings for Policy Information Point used by the Policy Decision Point to … … 30 32 31 33 # If omitted, DN of SSL Cert is used 32 pip.attributeQuery.issuerName = 33 pip.attributeQuery.subjectIdFormat = urn:esg:openid 34 pip.attributeQuery.clockSkewTolerance = 0. 35 pip.attributeQuery.queryAttributes.0 = urn:siteA:security:authz:1.0:attr, , http://www.w3.org/2001/XMLSchema#string 36 pip.attributeQuery.sslCACertDir=%(testConfigDir)s/ca 37 pip.attributeQuery.sslCertFilePath=%(testConfigDir)s/pki/test.crt 38 pip.attributeQuery.sslPriKeyFilePath=%(testConfigDir)s/pki/test.key 34 pep.authzDecisionQuery.issuerName = 35 pep.authzDecisionQuery.subjectIdFormat = urn:esg:openid 36 pep.authzDecisionQuery.clockSkewTolerance = 0. 37 pep.authzDecisionQuery.sslCACertDir=%(testConfigDir)s/ca 38 pep.authzDecisionQuery.sslCertFilePath=%(testConfigDir)s/pki/test.crt 39 pep.authzDecisionQuery.sslPriKeyFilePath=%(testConfigDir)s/pki/test.key -
TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/wsgi/authz/test_authz.py
r7077 r7164 11 11 __revision__ = '$Id$' 12 12 import logging 13 13 logging.basicConfig(level=logging.DEBUG) 14 14 15 15 import unittest … … 17 17 from urlparse import urlunsplit 18 18 19 from os.path import expandvars as xpdVars 20 from os.path import join as jnPath 21 mkPath = lambda file: jnPath(os.environ['NDGSEC_COMBINED_SRVS_UNITTEST_DIR'], 22 file) 19 from os import path 23 20 from ConfigParser import SafeConfigParser 24 21 … … 33 30 HTTPRedirectPEPResultHandlerMiddleware 34 31 from ndg.security.server.wsgi.authz import SamlPIPMiddlewareConfigError 35 from ndg.security.common.authz.msi import Response36 32 37 33 … … 97 93 def save(self): 98 94 pass 99 100 101 class TestAuthZMiddleware(object):102 '''Test Application for the Authentication handler to protect'''103 response = "Test Authorization application"104 105 def __init__(self, app_conf, **local_conf):106 pass107 108 def __call__(self, environ, start_response):109 110 if environ['PATH_INFO'] == '/test_401':111 status = "401 Unauthorized"112 113 elif environ['PATH_INFO'] == '/test_403':114 status = "403 Forbidden"115 116 elif environ['PATH_INFO'] == '/test_200':117 status = "200 OK"118 119 elif environ['PATH_INFO'] == '/test_accessDeniedToSecuredURI':120 # Nb. AuthZ middleware should intercept the request and bypass this121 # response122 status = "200 OK"123 124 elif environ['PATH_INFO'] == '/test_accessGrantedToSecuredURI':125 status = "200 OK"126 else:127 status = "404 Not found"128 129 start_response(status,130 [('Content-length',131 str(len(TestAuthZMiddleware.response))),132 ('Content-type', 'text/plain')])133 return [TestAuthZMiddleware.response]134 135 136 class BeakerSessionStub(dict):137 """Emulate beaker.session session object for purposes of the unit tests138 """139 def save(self):140 pass141 95 142 96 143 97 class SamlWSGIAuthZTestCase(BaseTestCase): 144 98 INI_FILE = 'saml-test.ini' 145 THIS_DIR = os.path.dirname(os.path.abspath(__file__))99 THIS_DIR = path.dirname(path.abspath(__file__)) 146 100 def __init__(self, *args, **kwargs): 147 101 BaseTestCase.__init__(self, *args, **kwargs) … … 276 230 INI_FILE = 'pep-result-handler-test.ini' 277 231 THIS_DIR = os.path.dirname(os.path.abspath(__file__)) 278 INI_FILEPATH = jnPath(THIS_DIR, INI_FILE)232 INI_FILEPATH = path.join(THIS_DIR, INI_FILE) 279 233 280 234 def __init__(self, *arg, **kw): … … 282 236 283 237 here_dir = os.path.dirname(os.path.abspath(__file__)) 284 wsgiapp = loadapp('config:'+ PEPResultHandlerTestCase.INI_FILE,285 relative_to= PEPResultHandlerTestCase.THIS_DIR)238 wsgiapp = loadapp('config:'+self.__class__.INI_FILE, 239 relative_to=self.__class__.THIS_DIR) 286 240 self.app = paste.fixture.TestApp(wsgiapp) 287 241 288 cfg = SafeConfigParser(dict(here= PEPResultHandlerTestCase.THIS_DIR))289 cfg.read( jnPath(PEPResultHandlerTestCase.INI_FILEPATH))242 cfg = SafeConfigParser(dict(here=self.__class__.THIS_DIR)) 243 cfg.read(self.__class__.INI_FILEPATH) 290 244 self.redirectURI = cfg.get('filter:AuthZFilter', 291 245 'authz.pepResultHandler.redirectURI') … … 300 254 extra_environ = { 301 255 'beaker.session.ndg.security': 302 BeakerSessionStub(username=PEPResultHandlerTestCase.OPENID_URI)256 BeakerSessionStub(username=self.__class__.OPENID_URI) 303 257 } 304 258
Note: See TracChangeset
for help on using the changeset viewer.