Merge pull request #110 from sigmavirus24/add_cookie_header_to_digest_auth

Send/require a cookie header on digest-auth
This commit is contained in:
Kenneth Reitz
2013-08-01 19:04:47 -07:00
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -356,8 +356,10 @@ def digest_auth(qop=None, user='user', passwd='passwd'):
auth.set_digest('me@kennethreitz.com', nonce, opaque=opaque,
qop=('auth', 'auth-int') if qop is None else (qop, ))
response.headers['WWW-Authenticate'] = auth.to_header()
response.headers['Set-Cookie'] = 'fake=fake_value'
return response
elif not check_digest_auth(user, passwd):
elif not (check_digest_auth(user, passwd) and
request.headers.get('Cookie')):
return status_code(401)
return jsonify(authenticated=True, user=user)
+2 -2
View File
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from httpbin import app
from flaskext.script import Manager, Command
from flask.ext.script import Manager, Command
manager = Manager(app)
@@ -15,4 +15,4 @@ def hello():
if __name__ == "__main__":
manager.run()
manager.run()