source: TI12-security/trunk/python/NDG/attAuthority_services_server.py @ 674

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/NDG/attAuthority_services_server.py@674
Revision 674, 3.2 KB checked in by pjkersha, 14 years ago (diff)

* Working version for mapped certificates *

ndgSessionClient.py:

  • renamed dict to argDict to avoid clash with existing arg var.
  • added code for handling ext attCert list and trusted host list files.
  • Changed so that --connect and --req-autho can be specified together so that a connect call is

concatenated with a call to request authorisation.

attAuthorityIOtest.py: unit tests for AttAuthorityIO classes.
attCertTest.py: unit tests for AttCert?.

AttAuthorityIO.py:

attAuthority_services_server.py: update and fixes to GetTrustedHostInfo? WS stub.

AttAuthority?.py:

AttCert?.py: !! important fix - added nonzero method so that test on AttCert? instance
yields True e.g. if attCert: ...

Session.py:

  • SessionMgr?.readProperties - only strip white space from XML data if it's string type -

elementtree sets content to None if an empty tag is present in the XML it's reading.

CredWallet?.py: changes to WS calls - use AttAuthorityIO classes - AuthorisationReq/?
AuthorisationResp? + TrustedHostInfoReq/TrustedHostInfoResp?.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1"""NDG Attribute Authority Web service server side interface.  Generated and
2adapted from:
3
4wsdl2dispatch -f attAuthority.wsdl
5
6NERC Data Grid Project
7
8P J Kershaw 19/01/06
9
10Copyright (C) 2006 CCLRC & NERC
11
12This software may be distributed under the terms of the Q Public License,
13version 1.0 or later.
14"""
15
16cvsID = '$Id$'
17
18from attAuthority_services import *
19from ZSI.ServiceContainer import ServiceSOAPBinding
20
21from AttAuthority import *
22
23# Create custom XML formatted error response where needed
24from AttAuthorityIO import *
25
26
27class attAuthority(ServiceSOAPBinding):
28    soapAction = {
29        'urn:attAuthority#getTrustedHostInfo': 'soap_getTrustedHostInfo',
30        'urn:attAuthority#reqAuthorisation': 'soap_reqAuthorisation',
31        }
32
33    def __init__(self, srv, debug=False, post='/attAuthority.wsdl', **kw):
34       
35        ServiceSOAPBinding.__init__(self, post)
36
37        # Link WS to underlying attribute authority class instance
38        if not isinstance(srv, AttAuthority):
39            AttAuthorityError("Expecting AttAuthority type")
40           
41        self.__srv = srv
42       
43        self.__debug = debug
44       
45
46    #_________________________________________________________________________
47    def soap_getTrustedHostInfo(self, ps):
48       
49        if self.__debug:
50            import pdb
51            pdb.set_trace()
52       
53        # input vals in request object
54        reqArgs = ps.Parse(trustedHostInfoRequestWrapper)
55        reqTxt = str(reqArgs._trustedHostInfoReq)
56       
57        # assign return values to response object
58        resp = trustedHostInfoResponseWrapper()
59       
60       
61        try:
62            trustedHosts = self.__srv.getTrustedHostInfo(reqXMLtxt=reqTxt)
63            trustedHostInfoResp = TrustedHostInfoResp(\
64                                                   trustedHosts=trustedHosts)                                         
65        except Exception, e:
66            trustedHostInfoResp = TrustedHostInfoResp(errMsg=str(e))
67
68        resp._trustedHostInfoResp = str(trustedHostInfoResp)
69        return resp
70
71
72    #_________________________________________________________________________
73    def soap_reqAuthorisation(self, ps):
74
75        if self.__debug:
76            import pdb
77            pdb.set_trace()
78       
79        # input vals in request object
80        reqArgs = ps.Parse(authorisationRequestWrapper)
81        reqTxt = str(reqArgs._authorisationReq)
82
83        # assign return values to response object
84        resp = authorisationResponseWrapper()
85       
86       
87        try:
88            attCert = self.__srv.authorise(reqXMLtxt=reqTxt)
89           
90            authorisationResp = AuthorisationResp(\
91                                    credential=attCert,
92                                    statCode=AuthorisationResp.accessGranted)
93           
94        except AttAuthorityAccessDenied, e:
95            authorisationResp = AuthorisationResp(errMsg=str(e),
96                                    statCode=AuthorisationResp.accessDenied)
97           
98        except Exception, e:
99            authorisationResp = AuthorisationResp(errMsg=str(e),
100                                    statCode=AuthorisationResp.accessError)
101       
102       
103        resp._authorisationResp = str(authorisationResp)
104        return resp
Note: See TracBrowser for help on using the repository browser.