Changeset 8795


Ignore:
Timestamp:
02/09/13 10:53:30 (6 years ago)
Author:
mnagni
Message:

Incomplete - # 22802: [CEDA Site Python Port] Login - no message is displayed when the user enters the wrong password
 http://team.ceda.ac.uk/trac/ceda/ticket/22802

The last update added a bug on the logout. Fixed

Location:
mauRepo/dj_security_middleware/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/dj_security_middleware/trunk/README

    r8792 r8795  
    2121then the AUTH_TKT will be removed from the next response  
    2222 
    23 The configuration is quite straightforward. In your Django app settings.py add: 
     23The middleware is configurable through the local_setting.py 
    2424 
    25 1) 'dj_security_middleware.middleware.DJ_Security_Middleware' to MIDDLEWARE_CLASSES 
    26  
    27 2) DJ_SECURITY_LOGIN_SERVICE to specify where the URL where authentication service  
     251) DJ_SECURITY_LOGIN_SERVICE specifies where the URL where authentication service  
    2826is listening (say http://my.domain.ac.uk/login) 
    2927 
    30 3) SECURITY_SHAREDSECRET (optional, default='sharedsecret') to specify  
     282) DJ_SECURITY_FILTER (optional, default = []) is a list of regular expressions used to filter  
     29which URLs the middleware SHOULD NOT protect 
     30 
     31 
     32 
     33 
     34Please note that the dj_security and this middleware layer are supposed 
     35to be independent each other; however in order to delete the AUTH_TKT the dj_security 
     36and this middelware have to share the following parameters: 
     37 
     381) AUTH_TKT (default='auth_tkt'): the name of the cookie generated after the authentication succeed 
     39 
     402) COOKIE_DOMAIN (default='.rl.ac.uk'): the domain where the AUTH_TKT will belong 
     41 
     423) SECURITY_SHAREDSECRET (default='sharedsecret') to specify  
    3143the secret key used by the authentication service to encrypt the AUTH_TKT cookie 
    3244 
    33 4) DJ_SECURITY_FILTER (optional) is a list of regular expressions used to filter  
    34 which URLs the middleware SHOULD NOT protect 
     454) REDIRECT_FIELD_NAME (default = 'r') specifies the name of the GET parameter  
     46containing return address to be used by the authentication layer if login is successful  
    3547 
    36 5) DJ_SECURITY_AUTH_CHECK (optional) is a function which returns a boolean  
     485) TOKEN_FIELD_NAME (default = 't') specifies the name of the GET parameter  
     49containing token after a reset password action has been executed 
     50 
     51 
     52 
     53 
     54Other parameters minor configurable parameters are: 
     55 
     561) DJ_SECURITY_AUTH_CHECK (optional) is a function which returns a boolean  
    3757shall accept one parameter where the middleware will pass the HTTPRequest. 
    3858If the function raises an exception, returns False or None the middleware forces 
     
    4969-------------------------------- 
    5070 
    51 6) DJ_MIDDLEWARE_IP (optional) to specify the client machine where the middleware is installed  
     712) DJ_MIDDLEWARE_IP (optional) to specify the client machine where the middleware is installed  
    5272(say '123.456.7.8'). The reason for this is that the client machine could be behind  
    5373a proxy and in this case the authentication service uses the remote machine IP,  
    5474the proxy in this case, to encrypt the cookie.  
    5575 
    56 7) REDIRECT_FIELD_NAME (optional, default = 'r') specifies the name of the GET parameter  
    57 containing return address to be used by the authentication layer if login is successful  
    5876 
    59 8) TOKEN_FIELD_NAME (optional, default = 't') specifies the name of the GET parameter  
    60 containing token after a reset password action has been executed 
     77 
  • mauRepo/dj_security_middleware/trunk/dj_security_middleware/__init__.py

    r8792 r8795  
    1414 
    1515def cookie_domain(): 
    16     return getattr(settings, 'COOKIE_DOMAIN', None) 
     16    return getattr(settings, 'COOKIE_DOMAIN', '.rl.ac.uk') 
    1717 
    1818def reset_password(): 
  • mauRepo/dj_security_middleware/trunk/dj_security_middleware/middleware.py

    r8792 r8795  
    4141    MissingCookieException 
    4242from dj_security_middleware import _get_host_ip, security_filter, auth_tkt_name,\ 
    43     shared_secret, token_field_name, redirect_field_name 
     43    shared_secret, token_field_name, redirect_field_name, cookie_domain 
    4444 
    4545import socket 
     
    8888        if len(request.REQUEST.get(LOGOUT, '')) > 0: 
    8989            response = HttpResponseRedirect(_build_url(request))             
    90             response.delete_cookie(auth_tkt_name()) 
     90            response.delete_cookie(auth_tkt_name(), domain = cookie_domain()) 
    9191            return response 
    9292 
Note: See TracChangeset for help on using the changeset viewer.