Ignore:
Timestamp:
16/06/06 14:17:07 (14 years ago)
Author:
astephen
Message:

Updated lots of stuff to get zsi working with version 2.0 or lower.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI04-geosplat/trunk/pygsc/SecurityViaCGI.py

    r798 r1210  
    3636        self.username=username 
    3737        self.password=password 
     38        # Note secureToken is not used by browser client which gets input from  
     39        # os.environ["HTTP_COOKIE"] 
    3840        self.secureToken=secureToken 
    3941 
     
    4547        # First check if the user is valid via a cookie 
    4648        cookieCheck=self._checkCookie() 
    47 #       o=open('/tmp/tmp/cook.txt','w'); o.write(str(cookieCheck)) ; o.close() 
     49        #o=open('/tmp/tmp/cook.txt','w'); o.write(str(cookieCheck)) ; o.close() 
    4850 
    4951        if type(cookieCheck)==type(""): 
     
    7880        else: 
    7981            return "Username '%s' unknown." % self.username 
     82  
    8083 
    8184    def _createCookie(self, username, userRoles, expiryTime=None): 
     
    8487        """ 
    8588        # NOTE: This should be brought up to date with W3C spec on Cookies 
    86         cookieString="%s:%s:%s" % (username, string.join(userRoles, ","), time.time()+TOKEN_VALID_LIFETIME) 
     89        endTime=time.time()+TOKEN_VALID_LIFETIME 
     90        endTimeString=time.strftime("%d/%m/%y %H:%M%S", time.localtime(endTime)) 
     91        cookieString="%s:%s:%s" % (username, string.join(userRoles, ","), endTime) 
    8792        cookieMaker=Cookie.SimpleCookie() 
    8893        cookieMaker[COOKIE_NAME]=cookieString 
    89         cookieMaker[COOKIE_NAME]["domain"]=TOKEN_DOMAIN 
     94        #cookieMaker[COOKIE_NAME]["domain"]=TOKEN_DOMAIN 
     95        cookieMaker[COOKIE_NAME]["path"]="/" 
    9096 
    9197        # Use expiry time of zero to delete a cookie, or other time if used 
    92         if expiryTime!=None: 
    93             cookieMaker[COOKIE_NAME]["expires"]=expiryTime 
     98        if expiryTime==None: 
     99            expiryTime=endTimeString 
     100                 
     101        cookieMaker[COOKIE_NAME]["expires"]=expiryTime 
    94102 
    95103        # Set the cookie 
    96104        print cookieMaker 
    97         #o=open('/tmp/tmp/out.txt', 'w'); o.write("%s" % cookieString) ; o.close() 
     105        #o=open('/tmp/tmp/out.txt', 'w'); o.write("%s" % (cookieString+"\n"+TOKEN_DOMAIN)) ; o.close() 
    98106         
    99107        return cookieString 
     
    142150        if not os.environ.has_key("HTTP_COOKIE"): 
    143151            cookieString=None 
     152            #out=open("/tmp/tmp/iscookie.txt","w");out.write("%s" % cookieString); out.close() 
    144153        else: 
    145154            cookieReader.load(os.environ["HTTP_COOKIE"]) 
Note: See TracChangeset for help on using the changeset viewer.