Changeset 5450


Ignore:
Timestamp:
02/07/09 10:13:50 (11 years ago)
Author:
pjkersha
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/integration/authz_lite/securedapp.py

    r5447 r5450  
    3232"/test_accessDeniedToSecuredURI": "test_accessDeniedToSecuredURI" 
    3333    } 
     34    header = """        <h1>Authorisation Integration Tests:</h1> 
     35        <p>Test Authorisation middleware with no Session Manager running. 
     36        See the authz/ integration test directory for a configuration including 
     37        a Session Manager</p> 
     38        <p>These tests use require the security services application to be 
     39        running.  See securityserviceapp.py and securityservices.ini in the  
     40        authz_lite/ integration test directory.</p> 
     41        <h2>To Run:</h2> 
     42        <p>Try any of the links below.  When prompt for username and password, 
     43        enter one of the sets of credentials from securityservices.ini 
     44        openid.provider.authN.userCreds section.  The defaults are: 
     45        </p> 
     46        <p>pjk/testpassword</p> 
     47        <p>another/testpassword</p> 
     48        <p>The attributeinterface.py AttributeAuthority plugin is configured to 
     49        grant access to 'pjk' for all URLs below apart from  
     50        'test_accessDeniedToSecuredURI'.  The 'another' account will be denied 
     51        access from all URLs apart from 'test_401'</p> 
     52""" 
    3453 
    3554    def __init__(self, app, globalConfig, **localConfig): 
     
    5675    <head/> 
    5776    <body> 
    58         <h1>Authorisation integration tests:</h1> 
    59         <ul>%s</ul> 
    60         <p>You are logged in with OpenID [%s].  <a href="/logout">Logout</a></p> 
    61     </body> 
    62 </html> 
    63 """ % ('\n'.join(['<li><a href="%s">%s</a></li>' % (link, name)  
    64                  for link,name in self.method.items() if name != 'default']), 
    65        environ['REMOTE_USER']) 
    66          
    67             start_response('200 OK',  
    68                            [('Content-type', 'text/html'), 
    69                             ('Content-length', str(len(response)))]) 
    70         else: 
    71             response = """<html> 
    72     <head/> 
    73     <body> 
    74         <h1>Authorisation integration tests:</h1> 
    75         <ul>%s</ul> 
    76     </body> 
    77 </html> 
    78 """ % '\n'.join(['<li><a href="%s">%s</a></li>' % (link, name)  
     77        %s 
     78        <ul>%s</ul> 
     79        <p>You are logged in with OpenID [%s].  <a href="/logout">Logout</a></p> 
     80    </body> 
     81</html> 
     82""" % (AuthZTestMiddleware.header, 
     83       '\n'.join(['<li><a href="%s">%s</a></li>' % (link, name)  
     84                 for link,name in self.method.items() if name != 'default']), 
     85       environ['REMOTE_USER']) 
     86         
     87            start_response('200 OK',  
     88                           [('Content-type', 'text/html'), 
     89                            ('Content-length', str(len(response)))]) 
     90        else: 
     91            response = """<html> 
     92    <head/> 
     93    <body> 
     94        %s 
     95        <ul>%s</ul> 
     96    </body> 
     97</html> 
     98""" % (AuthZTestMiddleware.header, 
     99       '\n'.join(['<li><a href="%s">%s</a></li>' % (link, name)  
    79100                 for link,name in self.method.items() if name != 'default']) 
     101       ) 
    80102 
    81103            start_response('200 OK',  
Note: See TracChangeset for help on using the changeset viewer.