Michael Merickel
2017-06-09 5452f1abd785841ea1510945122f4d2f811ac8f0
Merge pull request #3079 from m-click/fix-basic-auth-forbidden-view

Fix forbidden_view for BasicAuthAuthenticationPolicy (#3066)
2 files modified
12 ■■■■■ changed files
CONTRIBUTORS.txt 2 ●●●●● patch | view | raw | blame | history
pyramid/authentication.py 10 ●●●●● patch | view | raw | blame | history
CONTRIBUTORS.txt
@@ -302,3 +302,5 @@
- Jeremy(Ching-Rui) Chen, 2017/04/19
- Fang-Pen Lin, 2017/05/22
- Volker Diels-Grabsch, 2017/06/09
pyramid/authentication.py
@@ -1084,10 +1084,12 @@
        from pyramid.view import forbidden_view_config
        @forbidden_view_config()
        def basic_challenge(request):
            response = HTTPUnauthorized()
            response.headers.update(forget(request))
            return response
        def forbidden_view(request):
            if request.authenticated_userid is None:
                response = HTTPUnauthorized()
                response.headers.update(forget(request))
                return response
            return HTTPForbidden()
    """
    def __init__(self, check, realm='Realm', debug=False):
        self.check = check