source: TI12-security/trunk/python/www/cgi-bin/sp.py @ 1337

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/www/cgi-bin/sp.py@1337
Revision 1337, 2.1 KB checked in by pjkersha, 14 years ago (diff)

www/cgi-bin/idp.py: Security CGI for NDG Identity Provider
www/cgi-bin/sp.py: Security CGI for NDG Service Provider requesting credentials
NDG/SecurityCGI.py: continued re-working to split into two the two distinct components in the interface:

  • Service Provider interface - requests credentials for a user
  • Identity Provider interface - accepts requests from a Service Provider interface for credentials and interacts

with the user to retrieve them as required.

  • Property svn:executable set to *
RevLine 
[1337]1#!/usr/local/NDG/ActivePython-2.4/bin/python
2
3"""Example NDG Security CGI Service Provider Id Request Service
4
5NERC Data Grid Project
6
7P J Kershaw 27/07/06
8
9Copyright (C) 2006 CCLRC & NERC
10
11This software may be distributed under the terms of the Q Public License,
12version 1.0 or later.
13"""
14import os
15from NDG.SecurityCGI import ServiceProviderSecurityCGI, SecurityCGIError
16
17
18class SPcgi(ServiceProviderSecurityCGI):
19    """CGI interface test class for NDG Security Service Provider requesting
20    user ID from an NDG Identity Provider"""
21
22    #_________________________________________________________________________
23    def showHomeSiteSelect(self, 
24               pageTitle='Select your home site to retrieve your credentials',
25               **kwargs):
26
27        super(self.__class__, self).showHomeSiteSelect(pageTitle, **kwargs)
28
29
30    #_________________________________________________________________________
31    def showCredsReceived(self,
32                              sessCookie,
33                                                  pageTitle='Credentials returned from IdP',
34                          bodyTxt='New Cookie set from credentials'):
35        """Called from receiveCredsResponse() once a cookie has been created.
36        Makes a page to set the cookie and display to the user that they have
37        been authenticated.  Derived class should override this method as
38        required"""
39        super(self.__class__, self).showCredsReceived(sessCookie,
40                                                      pageTitle=pageTitle,
41                                                      bodyTxt=bodyTxt)
42
43
44#_____________________________________________________________________________
45if __name__ == "__main__":
46
47    aaWSDL = 'http://gabriel.bnsc.rl.ac.uk/attAuthority.wsdl'
48    aaPubKeyFilePath = "/usr/local/NDG/conf/certs/gabriel-aa-cert.pem"
49
50    clntPubKeyFilePath = "../certs/GabrielCGI-cert.pem"
51    clntPriKeyFilePath = "../certs/GabrielCGI-key.pem"
52
53    spCGI = SPcgi(aaWSDL,
54                  scriptName=os.path.basename(__file__),
55                  aaPubKeyFilePath=aaPubKeyFilePath,
56                  clntPubKeyFilePath=clntPubKeyFilePath,
57                  clntPriKeyFilePath=clntPriKeyFilePath)
58    spCGI()
Note: See TracBrowser for help on using the repository browser.