Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#22362 closed Cleanup/optimization (fixed)

Authentication Middleware assertion message is only partially correct

Reported by: Keryn Knight <django@…> Owned by: nobody
Component: contrib.auth Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: yes UI/UX: no

Description

Currently, the middleware says The Django authentication middleware requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.sessions.middleware.SessionMiddleware'. which is true, but doesn't expound the need for the session middleware to be before the auth middleware, because it acts on the request.

eg:

MIDDLEWARE_CLASSES = (
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
)

would fail the assertion, where

MIDDLEWARE_CLASSES = (
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
)

would pass.

Change History (2)

comment:1 Changed 13 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 246face20984b70b93751d144760bfd9b45d2c09:

Fixed #22362 -- Improved AuthenticationMiddleware assertion message.

Thanks Keryn Knight.

comment:2 Changed 13 months ago by Tim Graham <timograham@…>

In ef3734693277242e98996f591d9acf39e8819441:

[1.7.x] Fixed #22362 -- Improved AuthenticationMiddleware assertion message.

Thanks Keryn Knight.

Backport of 246face209 from master

Note: See TracTickets for help on using tickets.
Back to Top