#3154: Problem with storing authenticated sessions in DB
------------------------------------+---------------------------------------
 Reporter:  [EMAIL PROTECTED]  |        Owner:  jonas
     Type:  defect                  |       Status:  new  
 Priority:  normal                  |    Milestone:       
Component:  general                 |      Version:  devel
 Severity:  major                   |   Resolution:       
 Keywords:                          |  
------------------------------------+---------------------------------------
Comment (by [EMAIL PROTECTED]):

 Ok, here is detailed description:

 As I said, I was installing completely new instance of TRAC. I use
 apache2, python2.4 and PostgreSQL 8.1.3. For authentication I installed
 !TracAccountManager plugin (trunk).
 I'd used such configuration with TRAC-0.9 before and everyting worked
 correctly.

 So, I configured TRAC to work with multiple repositories, base URL is
 https://projects.

 Apache config for this virtual host contains:
 {{{
 <Location />
    SetHandler      mod_python

    PythonHandler   trac.web.modpython_frontend
    PythonOption    TracEnvParentDir                /srv/trac

    PythonOption    TracUriRoot                     /
    SetEnv          PYTHON_EGG_CACHE
 /var/cache/apache2/python/

    Order allow,deny
    Allow from all
 </Location>

 Alias /trac/ /usr/share/trac/htdocs

 <LocationMatch /trac/>
    SetHandler None
 </LocationMatch>
 }}}

 Here are detailed steps:

  * Open TRAC repository '''Misc''' as anonymous user
 (https://projects/Misc)
  * Check '''session''' table, it's empty:
 {{{
 > psql -d tracmisc
 tracmisc=# select * from session;
    sid   | authenticated | last_visit
 ---------+---------------+------------
 (0 rows)
 }}}
  * Check trac.log:
 {{{
 2006-05-15 21:18:36,918  Trac[loader] DEBUG: Loading plugin
 webadmin.plugin from /usr/lib/python2.4/site-
 packages/TracAccountManager-0.1.2-py2.4.egg
 2006-05-15 21:18:37,095 Trac[session] DEBUG: Trying to restore session -
 sid: 4c53a05020e82762d255eaad, authenticated: 0, _new: True
 }}}
 The last line is my own debug code placed in '''get_session''' method
  * Login as user '''bogdans'''  (https://projects/Misc/login)
  * Check '''session''' table - it's still empty
  * Check trac.log:
 {{{
 2006-05-15 21:19:01,813 Trac[session] DEBUG: Promoting anonymous session
 4c53a05020e82762d255eaad to authenticated session for user bogdans
 2006-05-15 21:19:01,815 Trac[session] DEBUG: Trying to restore session -
 sid: bogdans, authenticated: 1, _new: False
 }}}
  * Try to set and store settings for user '''bogdans'''
 (https://projects/Misc/settings)
  * Check '''session''' table - it's still empty, but now sesson parameters
 are stored in '''sessing_attribute''' table:
 {{{
 tracmisc=# select * from session_attribute;
    sid   | authenticated | name  |         value
 ---------+---------------+-------+------------------------
  bogdans |             1 | email | [EMAIL PROTECTED]
  bogdans |             1 | name  | Kirill
 (2 rows)
 }}}
  1. Check trac.log:
 {{{
 2006-05-15 21:19:27,043 Trac[session] DEBUG: Trying to restore session -
 sid: bogdans, authenticated: 1, _new: False
 2006-05-15 21:19:27,062 Trac[session] INFO: Refreshing session bogdans
 2006-05-15 21:19:27,063 Trac[session] DEBUG: Purging old, expired,
 sessions.
 }}}

 As you can see, method '''save''' has never been called with '''_new =
 True''' even for the '''anonymous''' session. '''promote_session''' method
 was called after user logon, so I decided that '''self._new = False''' is
 wrong there. Now I see you're right about it, but therefore somewhere
 else, when we create an anonymous session sid we should call '''save'''
 for this session.

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/3154>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to