[Moin-user] Upgrade 1.5.7 > 1.7.2 external cookie problem

Michael Matthews mjmatthews1 at rcn.com
Tue Sep 16 19:49:18 EDT 2008


Thomas Waldmann wrote:
> I bet this comes from the "return request.finish()" you have in there.
>   

So what should I do there? Basically I want to the request/process to
end. The authenticator will redirect back with cookie and request is
re-invoked. I guess I saw this method as an exit strategy or someone
advised me. I wrote this awhile ago.

All this used to work in 1.5.x
>   
>> class ExternalCookie(BaseAuth):
>>     name = 'external_cookie'
>>     def request(self,request,user_obj, **kw):
>>         """ authenticate via external cookie """
>>         import Cookie
>>         cookiename = "NSFLAB" # XXX external cookie name you want to use
>>         try:
>>             cookie = Cookie.SimpleCookie(request.saved_cookie)
>>         except Cookie.CookieError:
>>             # ignore invalid cookies
>>             cookie = None
>>         import urllib
>>         if cookie and cookie.has_key(cookiename):
>>             cookievalue = cookie[cookiename].value
>>             cookievalue = urllib.unquote(cookievalue)
>>             cookievalue = cookievalue.decode('iso-8859-1')
>>             cookievalue = cookievalue.split('|')
>>         elif cookie and cookie.has_key('attESHr'):
>>             cookievalue = cookie['attESHr'].value
>>             cookievalue = urllib.unquote(cookievalue)
>>             cookievalue = cookievalue.decode('iso-8859-1')
>>             cookievalue = cookievalue.split('|')
>>             userid = cookievalue[2]
>>             cookievalue.append(userid.split('@')[0])
>> #            f = open("cookie.log", "a")
>> #            f.write("\n")
>> #            f.write(repr(cookie))
>> #            f.write(repr(cookievalue))
>> #            f.write("\n")
>> #            f.close()
>>         else : #------ no cookies
>>             url = hrloginurl + 'http://' + request.http_host + request.request_uri
>>             request.http_redirect(url)
>>             return request.finish()
>>     
>
> THIS! ^^^
>
> BTW, you can use logging.debug("...") instead of writing your own
> files. 
>
> With 1.7.x moin's logging configuration is very flexible and you can
> enable debug logging for specific modules. For temp. stuff, you can also
> use logging.warning("...") which likely comes through without changing
> the logging configuration.
>
>   
>>     auth = [ExternalCookie(),MoinAuth()]
>>     cookie_domain = '.nsf.att.com'
>>     
>
> Is the . at the beginning correct?
>
>
>   
Not sure. Cookie authentication IS working. That is not the problem. But
something is wrong with MoinMoin after authentication cycle is completed
and pagetrail is mangled for some reason.




More information about the Moin-user mailing list