Changeset 416


Ignore:
Timestamp:
02/06/05 18:04:18 (14 years ago)
Author:
pjkersha
Message:

* empty log message *

Location:
security/trunk/python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • security/trunk/python/AttAuthorityServer.py

    r415 r416  
    1616 
    1717from ZSI import dispatch 
    18 from attrAuthority_services import createAttrCertResponseWrapper 
     18from attrAuthority_services import reqAuthorisationResponseWrapper 
    1919import os 
    2020import tempfile 
     
    2727 
    2828 
    29 def createAttrCert(usrProxyCert, usrAttrCert): 
     29def reqAuthorisation(usrProxyCert, usrAttrCert): 
    3030 
    3131    """NDG Attribute Authority WS interface for user authorisation.""" 
    3232     
    33     response = createAttrCertResponseWrapper() 
     33    response = reqAuthorisationResponseWrapper() 
    3434 
    3535    # Write input proxy cert string to file for input into AttrAuthority 
    3636    # interface 
    37     pdb.set_trace() 
    3837    (fhTmpUsrProxyCert, tmpUsrProxyCertFilePath) = tempfile.mkstemp() 
    3938    os.write(fhTmpUsrProxyCert, usrProxyCert) 
     
    4140    # Request a new attribute certificate from the Attribute Authority 
    4241    try: 
    43         attrAuthority.createAttrCert(tmpUsrProxyCertFilePath, usrAttrCert) 
    44         response._status = "Access granted" 
     42        try: 
     43            attrAuthority.createAttrCert(tmpUsrProxyCertFilePath, 
     44                                         extAttrCertFileTxt=usrAttrCert) 
     45            response._status = "Access granted" 
     46 
     47        finally: 
     48            os.close(fhTmpUsrProxyCert) 
     49            os.remove(tmpUsrProxyCertFilePath) 
    4550         
    46     except AttrAuthorityError, attrAuthorityExcep: 
    47         response._status = "Access denied: " + str(attrAuthorityExcep) 
     51    except Exception, excep: 
     52        response._status = "Access denied: " + str(excep) 
    4853 
    49  
    50     os.close(fhTmpUsrProxyCert) 
    51     os.remove(tmpUsrProxyCertFilePath) 
    5254     
    5355    return response 
  • security/trunk/python/attAuthority.wsdl

    r415 r416  
    1111  xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    1212 
    13   <message name="createAttrCertRequest"> 
     13  <message name="reqAuthorisationRequest"> 
    1414    <part name="usrProxyCert" type="xsd:string"/> 
    1515    <part name="usrAttrCert" type="xsd:string"/> 
    1616  </message> 
    1717 
    18   <message name="createAttrCertResponse"> 
     18  <message name="reqAuthorisationResponse"> 
    1919    <part name="status" type="xsd:string"/> 
    2020  </message> 
     
    2222   
    2323  <portType name="attrAuthority"> 
    24     <operation name="createAttrCert"> 
    25       <input message="tns:createAttrCertRequest"/> 
    26       <output message="tns:createAttrCertResponse"/> 
     24    <operation name="reqAuthorisation"> 
     25      <input message="tns:reqAuthorisationRequest"/> 
     26      <output message="tns:reqAuthorisationResponse"/> 
    2727    </operation> 
    2828  </portType> 
     
    3131    <soap:binding style="rpc"  
    3232                      transport="http://schemas.xmlsoap.org/soap/http"/> 
    33     <operation name="createAttrCert"> 
    34       <soap:operation soapAction="urn:attrAuthority#createAttrCert"/> 
     33    <operation name="reqAuthorisation"> 
     34      <soap:operation soapAction="urn:attrAuthority#reqAuthorisation"/> 
    3535      <input> 
    3636        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
  • security/trunk/python/attrCertReq.py

    r415 r416  
    2121 
    2222 
    23 def attrCertReq(attrAuthorityWSDL, usrProxyCertFilePath, usrAttrCertFilePath): 
     23def attrCertReq(attrAuthorityWSDL, 
     24                usrProxyCertFilePath, 
     25                usrAttrCertFilePath=None): 
    2426     
    2527    """Request authorisation from NDG Attribute Authority Web Service.""" 
     
    4042                                (ioErr.filename, ioErr.strerror) 
    4143 
     44 
     45    # Simlarly for Attribute Certificate if present ... 
     46    if usrAttrCertFilePath is not None: 
     47         
     48        try: 
     49            usrAttrCertFile = open(usrAttrCertFilePath, 'r') 
     50            usrAttrCert = usrAttrCertFile.read() 
     51            usrAttrCertFile.close() 
     52             
     53        except IOError, ioErr: 
     54            raise "Error reading attribute certificate file \"%s\": %s" % \ 
     55                                    (ioErr.filename, ioErr.strerror) 
     56    else: 
     57        usrAttrCert = None 
     58         
     59 
     60    # Call Web service 
    4261    try:    
    43         response = attrAuthoritySrv.createAttrCert(usrProxyCert=usrProxyCert, 
    44                                             usrAttrCert=usrAttrCertFilePath) 
     62        response=attrAuthoritySrv.reqAuthorisation(usrProxyCert=usrProxyCert, 
     63                                                   usrAttrCert=usrAttrCert) 
    4564         
    4665        print "Response: %s" % response['status'] 
Note: See TracChangeset for help on using the changeset viewer.