home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / ZSI / auth.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  2.1 KB  |  56 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from ZSI import *
  5. from ZSI import _copyright
  6. import base64
  7. import os
  8. _b64_decode = base64.decodestring
  9. _auth_tc = TC.Struct(None, [
  10.     TC.String('Name'),
  11.     TC.String('Password')], extras = 1)
  12.  
  13. class AUTH:
  14.     none = 0
  15.     httpbasic = 1
  16.     zsibasic = 2
  17.     httpdigest = 4
  18.  
  19.  
  20. class ClientBinding:
  21.     
  22.     def __init__(self, ps):
  23.         self.ps = ps
  24.         self.auth = None
  25.         self.environ = os.environ.copy()
  26.         self.environ['CONTENT_LENGTH'] = str(0)
  27.  
  28.     
  29.     def GetAuth(self):
  30.         if self.auth:
  31.             return self.auth
  32.         for elt in self.ps.GetMyHeaderElements():
  33.             if elt.localName == 'BasicAuth' and elt.namespaceURI == ZSI_SCHEMA_URI:
  34.                 d = _auth_tc.parse(elt, self.ps)
  35.                 self.auth = (AUTH.zsibasic, d['Name'], d['Password'])
  36.                 return self.auth
  37.         
  38.         ba = self.environ.get('HTTP_AUTHENTICATION')
  39.         self.auth = (AUTH.none,)
  40.         return self.auth
  41.  
  42.     
  43.     def GetNS(self):
  44.         if not self.ps.body_root.namespaceURI:
  45.             pass
  46.         return ''
  47.  
  48.     
  49.     def GetRequest(self):
  50.         return self.ps
  51.  
  52.  
  53. if __name__ == '__main__':
  54.     print _copyright
  55.  
  56.